summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2010-05-08 12:20:48 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2010-05-08 12:20:48 +0000
commitca9af72c4f2136d12227a7761f8963ec23ecbd64 (patch)
tree3468e497065da090767c30e4be2c9312726bafd4 /app
parent44f352c57ed103ad391992fdd93821e97f5ef4f2 (diff)
Update to xterm 258. lightly tested by krw@, thanks.
Diffstat (limited to 'app')
-rw-r--r--app/xterm/INSTALL16
-rw-r--r--app/xterm/KOI8RXTerm.ad6
-rw-r--r--app/xterm/MANIFEST2
-rw-r--r--app/xterm/Makefile14
-rw-r--r--app/xterm/Tekproc.c4
-rw-r--r--app/xterm/UXTerm.ad6
-rw-r--r--app/xterm/VTPrsTbl.c10
-rw-r--r--app/xterm/VTparse.def3
-rw-r--r--app/xterm/VTparse.h3
-rw-r--r--app/xterm/button.c142
-rw-r--r--app/xterm/cachedGCs.c8
-rw-r--r--app/xterm/charproc.c267
-rw-r--r--app/xterm/configure.in12
-rw-r--r--app/xterm/ctlseqs.ms15
-rw-r--r--app/xterm/ctlseqs.txt11
-rw-r--r--app/xterm/cursor.c8
-rw-r--r--app/xterm/doublechr.c4
-rw-r--r--app/xterm/fontutils.c41
-rw-r--r--app/xterm/fontutils.h4
-rw-r--r--app/xterm/input.c211
-rw-r--r--app/xterm/linedata.c31
-rw-r--r--app/xterm/main.c46
-rw-r--r--app/xterm/main.h6
-rw-r--r--app/xterm/menu.c16
-rw-r--r--app/xterm/minstall.sh18
-rw-r--r--app/xterm/misc.c60
-rw-r--r--app/xterm/print.c6
-rw-r--r--app/xterm/ptydata.c13
-rw-r--r--app/xterm/ptyx.h47
-rw-r--r--app/xterm/resize.c18
-rw-r--r--app/xterm/screen.c79
-rw-r--r--app/xterm/scrollback.c22
-rw-r--r--app/xterm/scrollbar.c326
-rw-r--r--app/xterm/sinstall.sh6
-rw-r--r--app/xterm/tabs.c10
-rw-r--r--app/xterm/testxmc.c12
-rw-r--r--app/xterm/trace.c7
-rw-r--r--app/xterm/trace.h8
-rw-r--r--app/xterm/util.c188
-rw-r--r--app/xterm/uxterm.desktop4
-rw-r--r--app/xterm/version.h4
-rw-r--r--app/xterm/xstrings.c6
-rw-r--r--app/xterm/xterm.desktop4
-rw-r--r--app/xterm/xterm.h48
-rw-r--r--app/xterm/xterm.log.html109
-rw-r--r--app/xterm/xterm.man28
-rw-r--r--app/xterm/xtermcap.c2
-rw-r--r--app/xterm/xtermcfg.h3
-rw-r--r--app/xterm/xtermcfg.hin7
49 files changed, 1308 insertions, 613 deletions
diff --git a/app/xterm/INSTALL b/app/xterm/INSTALL
index 2f85f3a40..d2afa33d2 100644
--- a/app/xterm/INSTALL
+++ b/app/xterm/INSTALL
@@ -1,6 +1,6 @@
--- $XTermId: INSTALL,v 1.121 2009/08/06 00:39:09 tom Exp $
+-- $XTermId: INSTALL,v 1.122 2010/04/14 10:56:29 tom Exp $
-------------------------------------------------------------------------------
--- Copyright 1997-2007,2008 by Thomas E. Dickey
+-- Copyright 1997-2009,2010 by Thomas E. Dickey
--
-- All Rights Reserved
--
@@ -258,6 +258,11 @@ The options (in alphabetic order):
leaving the right scrollbar incorrectly positioned after changing
the font size.
+ --disable-rpath-hack don't add rpath options for additional libraries
+
+ By default, the configure script looks for libraries in unusual places
+ and adds an rpath linker option to help.
+
--disable-samename disable check for redundant name-change
Do not compile-in code that suppresses redundant updates to the
@@ -561,6 +566,13 @@ The options (in alphabetic order):
If regular expressions are not disable (--disable-regex), use PCRE
rather than the POSIX regular expressions.
+ --with-pkg-config{=path} enable/disable use of pkg-config
+
+ The configure script looks for certain libraries which have well
+ established pkg-config scripts, and will use those settings if
+ available. Not all pkg-config scripts work; this option suppresses
+ the check and relies on normal library search paths.
+
--with-reference=XXX program to use as permissions-reference
To install xterm with setuid permissions, the scripts usually compare
diff --git a/app/xterm/KOI8RXTerm.ad b/app/xterm/KOI8RXTerm.ad
index 296bf51eb..acc82d27b 100644
--- a/app/xterm/KOI8RXTerm.ad
+++ b/app/xterm/KOI8RXTerm.ad
@@ -1,8 +1,8 @@
-! $XTermId: KOI8RXTerm.ad,v 1.3 2007/12/30 15:49:14 tom Exp $
+! $XTermId: KOI8RXTerm.ad,v 1.4 2010/03/04 01:17:49 tom Exp $
! -----------------------------------------------------------------------------
! this file is part of xterm
!
-! Copyright 2007 by Thomas E. Dickey
+! Copyright 2007,2010 by Thomas E. Dickey
!
! All Rights Reserved
!
@@ -36,7 +36,7 @@
! xterm -class KOI8RXTerm
! to set resources for KOI8-R mode with corresponding fonts.
-#include "XTerm-color"
+#include "XTerm"
*fontMenu.Label: KOI8-R Fonts
*VT100*allowC1Printable: true
diff --git a/app/xterm/MANIFEST b/app/xterm/MANIFEST
index 282f20a63..262de0b44 100644
--- a/app/xterm/MANIFEST
+++ b/app/xterm/MANIFEST
@@ -1,4 +1,4 @@
-MANIFEST for xterm-255, version xterm-255
+MANIFEST for xterm-258, version xterm-258
--------------------------------------------------------------------------------
MANIFEST this file
256colres.h resource-definitions for 256-color mode
diff --git a/app/xterm/Makefile b/app/xterm/Makefile
index fbb8f77b1..6e2a3dcbe 100644
--- a/app/xterm/Makefile
+++ b/app/xterm/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.14 2009/09/05 15:58:09 matthieu Exp $
+# $OpenBSD: Makefile,v 1.15 2010/05/08 12:20:46 matthieu Exp $
.include <bsd.xconf.mk>
SUBDIR= icons resize
@@ -54,15 +54,15 @@ CLEANFILES+= ${MAN}
afterinstall:
${INSTALL} ${INSTALL_COPY} -m 755 ${.CURDIR}/uxterm \
${DESTDIR}${BINDIR}
- ${INSTALL} ${INSTALL_COPY} -m 644 ${.CURDIR}/XTerm.ad \
+ ${INSTALL} ${INSTALL_COPY} -m 755 ${.CURDIR}/koi8rxterm \
+ ${DESTDIR}${BINDIR}
+ ${INSTALL_DATA} ${.CURDIR}/XTerm.ad \
${DESTDIR}${XETC}/app-defaults/XTerm
- ${INSTALL} ${INSTALL_COPY} -m 644 ${.CURDIR}/XTerm-col.ad \
+ ${INSTALL_DATA} ${.CURDIR}/XTerm-col.ad \
${DESTDIR}${XETC}/app-defaults/XTerm-color
- ${INSTALL} ${INSTALL_COPY} -m 644 ${.CURDIR}/UXTerm.ad \
+ ${INSTALL_DATA} ${.CURDIR}/UXTerm.ad \
${DESTDIR}${XETC}/app-defaults/UXTerm
- ${INSTALL} ${INSTALL_COPY} -m 755 ${.CURDIR}/koi8rxterm \
- ${DESTDIR}${BINDIR}
- ${INSTALL} ${INSTALL_COPY} -m 644 ${.CURDIR}/KOI8RXTerm.ad \
+ ${INSTALL_DATA} ${.CURDIR}/KOI8RXTerm.ad \
${DESTDIR}${XETC}/app-defaults/KOI8RXTerm
obj: _xenocara_obj
diff --git a/app/xterm/Tekproc.c b/app/xterm/Tekproc.c
index 483484a48..b84535ccf 100644
--- a/app/xterm/Tekproc.c
+++ b/app/xterm/Tekproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: Tekproc.c,v 1.175 2009/12/09 23:25:34 Jochen.Voss Exp $ */
+/* $XTermId: Tekproc.c,v 1.176 2010/04/18 16:22:54 tom Exp $ */
/*
* Warning, there be crufty dragons here.
@@ -754,7 +754,7 @@ Tekparse(TekWidget tw)
Char buf2[512];
IChar c2;
- unsigned len = 0;
+ size_t len = 0;
while ((c2 = input()) != ANSI_BEL) {
if (!isprint((int) (c2 & 0x7f))
|| len + 2 >= (int) sizeof(buf2))
diff --git a/app/xterm/UXTerm.ad b/app/xterm/UXTerm.ad
index 74597ae74..a2cca8526 100644
--- a/app/xterm/UXTerm.ad
+++ b/app/xterm/UXTerm.ad
@@ -1,8 +1,8 @@
-! $XTermId: UXTerm.ad,v 1.12 2006/02/13 01:14:58 tom Exp $
+! $XTermId: UXTerm.ad,v 1.13 2010/03/04 01:17:07 tom Exp $
! -----------------------------------------------------------------------------
! this file is part of xterm
!
-! Copyright 2000-2005,2006 by Thomas E. Dickey
+! Copyright 2000-2006,2010 by Thomas E. Dickey
!
! All Rights Reserved
!
@@ -35,7 +35,7 @@
! to set resources for UTF-8 mode with corresponding fonts.
! See the uxterm script for an example.
-#include "XTerm-color"
+#include "XTerm"
*fontMenu.Label: Unicode Fonts
*VT100.utf8: 1
diff --git a/app/xterm/VTPrsTbl.c b/app/xterm/VTPrsTbl.c
index e0057fd00..095b3c19d 100644
--- a/app/xterm/VTPrsTbl.c
+++ b/app/xterm/VTPrsTbl.c
@@ -1,4 +1,4 @@
-/* $XTermId: VTPrsTbl.c,v 1.55 2009/12/29 22:01:11 tom Exp $ */
+/* $XTermId: VTPrsTbl.c,v 1.57 2010/04/10 00:19:56 tom Exp $ */
/*
*
@@ -550,7 +550,7 @@ CASE_CPR,
CASE_GROUND_STATE,
/* p q r s */
CASE_GROUND_STATE,
-CASE_GROUND_STATE,
+CASE_DECLL,
CASE_DECSTBM,
CASE_DECSC,
/* t u v w */
@@ -710,7 +710,7 @@ CASE_CPR,
CASE_GROUND_STATE,
/* eth ntilde ograve oacute */
CASE_GROUND_STATE,
-CASE_GROUND_STATE,
+CASE_DECLL,
CASE_DECSTBM,
CASE_DECSC,
/* ocircumflex otilde odiaeresis division */
@@ -874,7 +874,7 @@ CASE_CPR,
CASE_GROUND_STATE,
/* p q r s */
CASE_GROUND_STATE,
-CASE_GROUND_STATE,
+CASE_DECLL,
CASE_DECSTBM,
CASE_DECSC,
/* t u v w */
@@ -1034,7 +1034,7 @@ CASE_CPR,
CASE_GROUND_STATE,
/* eth ntilde ograve oacute */
CASE_GROUND_STATE,
-CASE_GROUND_STATE,
+CASE_DECLL,
CASE_DECSTBM,
CASE_DECSC,
/* ocircumflex otilde odiaeresis division */
diff --git a/app/xterm/VTparse.def b/app/xterm/VTparse.def
index 8a9f08fcc..8e8d629cb 100644
--- a/app/xterm/VTparse.def
+++ b/app/xterm/VTparse.def
@@ -1,4 +1,4 @@
-# $XTermId: VTparse.def,v 1.37 2009/12/29 22:57:10 tom Exp $
+# $XTermId: VTparse.def,v 1.38 2010/04/09 10:47:24 tom Exp $
#
# vile:confmode rs=lf
# -----------------------------------------------------------------------------
@@ -181,3 +181,4 @@ CASE_SM_TITLE
CASE_RM_TITLE
CASE_DECSMBV
CASE_DECSWBV
+CASE_DECLL
diff --git a/app/xterm/VTparse.h b/app/xterm/VTparse.h
index 1df063be3..0fd5110c1 100644
--- a/app/xterm/VTparse.h
+++ b/app/xterm/VTparse.h
@@ -1,4 +1,4 @@
-/* $XTermId: VTparse.h,v 1.50 2009/12/29 22:57:16 tom Exp $ */
+/* $XTermId: VTparse.h,v 1.51 2010/04/09 22:29:17 tom Exp $ */
/*
* Copyright 2002-2008,2009 by Thomas E. Dickey
@@ -261,5 +261,6 @@ extern Const PARSE_T esc_pct_table[];
#define CASE_RM_TITLE 140
#define CASE_DECSMBV 141
#define CASE_DECSWBV 142
+#define CASE_DECLL 143
#endif /* included_VTparse_h */
diff --git a/app/xterm/button.c b/app/xterm/button.c
index 0cd6b974c..2976538c9 100644
--- a/app/xterm/button.c
+++ b/app/xterm/button.c
@@ -1,7 +1,7 @@
-/* $XTermId: button.c,v 1.364 2010/01/04 23:13:01 tom Exp $ */
+/* $XTermId: button.c,v 1.375 2010/04/18 17:48:58 tom Exp $ */
/*
- * Copyright 1999-2008,2009 by Thomas E. Dickey
+ * Copyright 1999-2009,2010 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -346,7 +346,7 @@ SendLocatorPosition(XtermWidget xw, XEvent * event)
state = (event->xbutton.state
& (Button1Mask | Button2Mask | Button3Mask | Button4Mask)) >> 8;
/* update mask to "after" state */
- state ^= 1 << button;
+ state ^= ((unsigned) (1 << button));
/* swap Button1 & Button3 */
state = ((state & (unsigned) ~(4 | 1))
| ((state & 1) ? 4 : 0)
@@ -836,10 +836,10 @@ DiredButton(Widget w,
if ((event->type == ButtonPress || event->type == ButtonRelease)
&& (event->xbutton.y >= screen->border)
&& (event->xbutton.x >= OriginX(screen))) {
- line = ((unsigned) (event->xbutton.y - screen->border)
- / FontHeight(screen));
- col = ((unsigned) (event->xbutton.x - OriginX(screen))
- / FontWidth(screen));
+ line = (unsigned) ((event->xbutton.y - screen->border)
+ / FontHeight(screen));
+ col = (unsigned) ((event->xbutton.x - OriginX(screen))
+ / FontWidth(screen));
Line[0] = CONTROL('X');
Line[1] = ANSI_ESC;
Line[2] = 'G';
@@ -1075,28 +1075,38 @@ DECtoASCII(unsigned ch)
}
return ch;
}
+
+#if OPT_WIDE_CHARS
+static Cardinal
+addXtermChar(Char ** buffer, Cardinal *used, Cardinal offset, unsigned value)
+{
+ if (offset + 1 >= *used) {
+ *used = 1 + (2 * (offset + 1));
+ allocXtermChars(buffer, *used);
+ }
+ (*buffer)[offset++] = (Char) value;
+ return offset;
+}
+#define AddChar(buffer, used, offset, value) \
+ offset = addXtermChar(buffer, used, offset, (unsigned) value)
+
/*
* Convert a UTF-8 string to Latin-1, replacing non Latin-1 characters by `#',
* or ASCII/Latin-1 equivalents for special cases.
*/
-#if OPT_WIDE_CHARS
static Char *
-UTF8toLatin1(TScreen * screen, Char * s, unsigned len, unsigned long *result)
+UTF8toLatin1(TScreen * screen, Char * s, unsigned long len, unsigned long *result)
{
static Char *buffer;
static Cardinal used;
- Char *p, *q;
+ Cardinal offset = 0;
- if (len > used) {
- used = 1 + (2 * len);
- allocXtermChars(&buffer, used);
- }
+ Char *p;
- if (buffer != 0) {
+ if (len != 0) {
PtyData data;
- q = buffer;
fakePtyData(&data, s, s + len);
while (decodeUtf8(&data)) {
Bool fails = False;
@@ -1105,17 +1115,17 @@ UTF8toLatin1(TScreen * screen, Char * s, unsigned len, unsigned long *result)
if (value == UCS_REPL) {
fails = True;
} else if (value < 256) {
- *q++ = CharOf(value);
+ AddChar(&buffer, &used, offset, CharOf(value));
} else {
unsigned eqv = ucs2dec(value);
if (xtermIsDecGraphic(eqv)) {
- *q++ = (Char) DECtoASCII(eqv);
+ AddChar(&buffer, &used, offset, DECtoASCII(eqv));
} else {
eqv = AsciiEquivs(value);
if (eqv == value) {
fails = True;
} else {
- *q++ = (Char) eqv;
+ AddChar(&buffer, &used, offset, eqv);
}
if (isWide((wchar_t) value))
extra = True;
@@ -1129,19 +1139,14 @@ UTF8toLatin1(TScreen * screen, Char * s, unsigned len, unsigned long *result)
*/
if (fails) {
for (p = (Char *) screen->default_string; *p != '\0'; ++p) {
- len = (unsigned) (3 + q - buffer);
- if (len >= used) {
- used = 1 + (2 * len);
- allocXtermChars(&buffer, used);
- }
- *q++ = *p;
+ AddChar(&buffer, &used, offset, *p);
}
}
if (extra)
- *q++ = ' ';
+ AddChar(&buffer, &used, offset, ' ');
}
- *q = 0;
- *result = (unsigned long) (q - buffer);
+ AddChar(&buffer, &used, offset, '\0');
+ *result = (unsigned long) (offset - 1);
} else {
*result = 0;
}
@@ -1184,8 +1189,8 @@ xtermUtf8ToTextList(XtermWidget xw,
new_size += size + 1;
}
new_text_list =
- (char **) XtMalloc(sizeof(char *) * (unsigned) *text_list_count);
- new_text_list[0] = tmp = XtMalloc(new_size);
+ (char **) XtMalloc((Cardinal) sizeof(char *) * (unsigned) *text_list_count);
+ new_text_list[0] = tmp = XtMalloc((Cardinal) new_size);
for (i = 0; i < (*text_list_count); ++i) {
data = (Char *) (*text_list)[i];
size = strlen((*text_list)[i]) + 1;
@@ -1264,12 +1269,13 @@ overrideTargets(Widget w, String value, Atom ** resultp)
if (copied[n] == ',')
++count;
}
- result = (Atom *) XtMalloc(((2 * count) + 1) * sizeof(Atom));
+ result = (Atom *) XtMalloc(((2 * count) + 1)
+ * (Cardinal) sizeof(Atom));
if (result == NULL) {
TRACE(("Couldn't allocate selection types\n"));
} else {
char nextc = '?';
- char *listp = copied;
+ char *listp = (char *) copied;
count = 0;
do {
char *nextp = parseItem(listp, &nextc);
@@ -1418,7 +1424,7 @@ UnmapSelections(XtermWidget xw)
if (screen->mappedSelect) {
for (n = 0; screen->mappedSelect[n] != 0; ++n)
- free(screen->mappedSelect[n]);
+ free((void *) screen->mappedSelect[n]);
free(screen->mappedSelect);
screen->mappedSelect = 0;
}
@@ -1478,10 +1484,10 @@ MapSelections(XtermWidget xw, String * params, Cardinal num_params)
* If it is not a cut-buffer, it is the primary selection (-1).
*/
static int
-CutBuffer(unsigned code)
+CutBuffer(Atom code)
{
int cutbuffer;
- switch (code) {
+ switch ((unsigned) code) {
case XA_CUT_BUFFER0:
cutbuffer = 0;
break;
@@ -1544,6 +1550,8 @@ xtermGetSelection(Widget w,
XtermWidget xw;
+ if (num_params == 0)
+ return;
if ((xw = getXtermWidget(w)) == 0)
return;
@@ -1739,7 +1747,7 @@ _qWriteSelectionData(TScreen * screen, Char * lag, unsigned length)
}
static void
-_WriteSelectionData(TScreen * screen, Char * line, unsigned length)
+_WriteSelectionData(TScreen * screen, Char * line, size_t length)
{
/* Write data to pty a line at a time. */
/* Doing this one line at a time may no longer be necessary
@@ -1792,7 +1800,7 @@ _WriteKey(TScreen * screen, Char * in)
{
Char line[16];
unsigned count = 0;
- unsigned length = strlen((char *) in);
+ size_t length = strlen((char *) in);
if (screen->control_eight_bits) {
line[count++] = ANSI_CSI;
@@ -1912,7 +1920,7 @@ SelectionReceived(Widget w,
}
#endif
for (i = 0; i < text_list_count; i++) {
- unsigned len = strlen(text_list[i]);
+ size_t len = strlen(text_list[i]);
_WriteSelectionData(screen, (Char *) text_list[i], len);
}
#if OPT_PASTE64
@@ -2496,23 +2504,23 @@ PointToCELL(TScreen * screen,
static int
LastTextCol(TScreen * screen, LineData * ld, int row)
{
- int i;
+ int i = -1;
Char *ch;
- if (okScrnRow(screen, row)) {
- for (i = screen->max_col,
- ch = ld->attribs + i;
- i >= 0 && !(*ch & CHARDRAWN);
- ch--, i--) {
- ;
- }
+ if (ld != 0) {
+ if (okScrnRow(screen, row)) {
+ for (i = screen->max_col,
+ ch = ld->attribs + i;
+ i >= 0 && !(*ch & CHARDRAWN);
+ ch--, i--) {
+ ;
+ }
#if OPT_DEC_CHRSET
- if (CSET_DOUBLE(GetLineDblCS(ld))) {
- i *= 2;
- }
+ if (CSET_DOUBLE(GetLineDblCS(ld))) {
+ i *= 2;
+ }
#endif
- } else {
- i = -1;
+ }
}
return (i);
}
@@ -2736,7 +2744,7 @@ static char *
make_indexed_text(TScreen * screen, int row, unsigned length, int *indexed)
{
Char *result = 0;
- unsigned need = (length + 1);
+ size_t need = (length + 1);
/*
* Get a quick upper bound to the number of bytes needed, if the whole
@@ -2781,13 +2789,13 @@ make_indexed_text(TScreen * screen, int row, unsigned length, int *indexed)
}
});
- indexed[used] = last - result;
+ indexed[used] = (int) (last - result);
*next = 0;
/* TRACE(("index[%d.%d] %d:%s\n", row, used, indexed[used], last)); */
last = next;
++used;
++col;
- indexed[used] = next - result;
+ indexed[used] = (int) (next - result);
}
} while (used < length &&
LineTstWrapped(ld) &&
@@ -2903,7 +2911,7 @@ do_select_regex(TScreen * screen, CELL * startc, CELL * endc)
for (col = 0; indexed[col] < len; ++col) {
if (regexec(&preg,
search + indexed[col],
- 1, &match, 0) == 0) {
+ (size_t) 1, &match, 0) == 0) {
int start_inx = match.rm_so + indexed[col];
int finis_inx = match.rm_eo + indexed[col];
int start_col = indexToCol(indexed, len, start_inx);
@@ -3317,7 +3325,7 @@ SaltTextAway(XtermWidget xw,
/* now get some memory to save it in */
if (screen->selection_size <= j) {
- if ((line = (Char *) malloc((unsigned) j + 1)) == 0)
+ if ((line = (Char *) malloc((size_t) j + 1)) == 0)
SysError(ERROR_BMALLOC2);
XtFree((char *) screen->selection_data);
screen->selection_data = line;
@@ -3364,7 +3372,7 @@ ClearSelectionBuffer(TScreen * screen)
}
static void
-AppendStrToSelectionBuffer(TScreen * screen, Char * text, unsigned len)
+AppendStrToSelectionBuffer(TScreen * screen, Char * text, size_t len)
{
if (len != 0) {
int j = (int) (screen->selection_length + len); /* New length */
@@ -3373,7 +3381,7 @@ AppendStrToSelectionBuffer(TScreen * screen, Char * text, unsigned len)
if (!screen->selection_length) {
/* New buffer */
Char *line;
- if ((line = (Char *) malloc((unsigned) k)) == 0)
+ if ((line = (Char *) malloc((size_t) k)) == 0)
SysError(ERROR_BMALLOC2);
XtFree((char *) screen->selection_data);
screen->selection_data = line;
@@ -3381,7 +3389,7 @@ AppendStrToSelectionBuffer(TScreen * screen, Char * text, unsigned len)
/* Realloc buffer */
screen->selection_data = (Char *)
realloc(screen->selection_data,
- (unsigned) k);
+ (size_t) k);
if (screen->selection_data == 0)
SysError(ERROR_BMALLOC2);
}
@@ -3423,21 +3431,21 @@ AppendToSelectionBuffer(TScreen * screen, unsigned c)
case 2:
ch = CharOf((screen->base64_accu << 6) + six);
screen->base64_count = 0;
- AppendStrToSelectionBuffer(screen, &ch, 1);
+ AppendStrToSelectionBuffer(screen, &ch, (size_t) 1);
break;
case 4:
ch = CharOf((screen->base64_accu << 4) + (six >> 2));
screen->base64_accu = (six & 0x3);
screen->base64_count = 2;
- AppendStrToSelectionBuffer(screen, &ch, 1);
+ AppendStrToSelectionBuffer(screen, &ch, (size_t) 1);
break;
case 6:
ch = CharOf((screen->base64_accu << 2) + (six >> 4));
screen->base64_accu = (six & 0xF);
screen->base64_count = 4;
- AppendStrToSelectionBuffer(screen, &ch, 1);
+ AppendStrToSelectionBuffer(screen, &ch, (size_t) 1);
break;
}
}
@@ -3497,13 +3505,15 @@ SaveConvertedLength(XtPointer *target, unsigned long source)
if (sizeof(unsigned long) == 4) {
*(unsigned long *) *target = source;
} else if (sizeof(unsigned) == 4) {
- *(unsigned *) *target = source;
+ *(unsigned *) *target = (unsigned) source;
} else if (sizeof(unsigned short) == 4) {
*(unsigned short *) *target = (unsigned short) source;
} else {
/* FIXME - does this depend on byte-order? */
unsigned long temp = source;
- memcpy((char *) *target, ((char *) &temp) + sizeof(temp) - 4, 4);
+ memcpy((char *) *target,
+ ((char *) &temp) + sizeof(temp) - 4,
+ (size_t) 4);
}
}
return result;
@@ -3644,7 +3654,7 @@ ConvertSelection(Widget w,
}
#endif
else if (*target == XA_LIST_LENGTH(dpy)) {
- result = SaveConvertedLength(value, 1);
+ result = SaveConvertedLength(value, (unsigned long) 1);
*type = XA_INTEGER;
*length = 1;
*format = 32;
@@ -3726,6 +3736,8 @@ _OwnSelection(XtermWidget xw,
Cardinal i;
Bool have_selection = False;
+ if (count == 0)
+ return;
if (screen->selection_length == 0)
return;
diff --git a/app/xterm/cachedGCs.c b/app/xterm/cachedGCs.c
index 9a5970ff0..3b5608279 100644
--- a/app/xterm/cachedGCs.c
+++ b/app/xterm/cachedGCs.c
@@ -1,8 +1,8 @@
-/* $XTermId: cachedGCs.c,v 1.56 2009/11/28 13:24:07 tom Exp $ */
+/* $XTermId: cachedGCs.c,v 1.59 2010/04/15 00:00:17 tom Exp $ */
/************************************************************
-Copyright 2007-2008,2009 by Thomas E. Dickey
+Copyright 2007-2009,2010 by Thomas E. Dickey
All Rights Reserved
@@ -65,7 +65,7 @@ typedef struct {
} CgsCacheData;
#define DEPTH 8
-#define ITEM() (me->data - me->list)
+#define ITEM() (int) (me->data - me->list)
#define LIST(item) me->list[item]
#define LINK(item) me->data = (me->list + (item))
#define THIS(field) me->data->field
@@ -549,7 +549,7 @@ clrCgsFonts(XtermWidget xw, VTwin * cgsWin, XTermFonts * font)
traceFont(font)));
NEXT(font) = 0;
NEXT(cset) = 0;
- me->mask &= ~(GCFont | GC_CSet);
+ me->mask &= (unsigned) ~(GCFont | GC_CSet);
}
}
}
diff --git a/app/xterm/charproc.c b/app/xterm/charproc.c
index 42b530a4e..b996ac412 100644
--- a/app/xterm/charproc.c
+++ b/app/xterm/charproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: charproc.c,v 1.1033 2010/01/20 01:59:19 tom Exp $ */
+/* $XTermId: charproc.c,v 1.1055 2010/04/18 17:48:58 tom Exp $ */
/*
@@ -225,6 +225,11 @@ static char defaultTranslations[] =
Shift <KeyPress> Select:select-cursor-start() select-cursor-end(SELECT, CUT_BUFFER0) \n\
Shift <KeyPress> Insert:insert-selection(SELECT, CUT_BUFFER0) \n\
"
+#if OPT_SCROLL_LOCK
+"\
+ <KeyRelease> Scroll_Lock:scroll-lock() \n\
+"
+#endif
#if OPT_SHIFT_FONTS
"\
Shift~Ctrl <KeyPress> KP_Add:larger-vt-font() \n\
@@ -386,6 +391,9 @@ static XtActionsRec actionsList[] = {
#if OPT_SCO_FUNC_KEYS
{ "set-sco-function-keys", HandleScoFunctionKeys },
#endif
+#if OPT_SCROLL_LOCK
+ { "scroll-lock", HandleScrollLock },
+#endif
#if OPT_SHIFT_FONTS
{ "larger-vt-font", HandleLargerFont },
{ "smaller-vt-font", HandleSmallerFont },
@@ -718,6 +726,10 @@ static XtResource xterm_resources[] =
Sres(XtNximFont, XtCXimFont, misc.f_x, DEFXIMFONT),
#endif
+#if OPT_SCROLL_LOCK
+ Bres(XtNallowScrollLock, XtCAllowScrollLock, screen.allowScrollLock0, True),
+#endif
+
#if OPT_XMC_GLITCH
Bres(XtNxmcInline, XtCXmcInline, screen.xmc_inline, False),
Bres(XtNxmcMoveSGR, XtCXmcMoveSGR, screen.move_sgr_ok, True),
@@ -851,6 +863,9 @@ xtermAddInput(Widget w)
#if OPT_DABBREV
{ "dabbrev-expand", HandleDabbrevExpand },
#endif
+#if OPT_SCROLL_LOCK
+ { "scroll-lock", HandleScrollLock },
+#endif
#if OPT_SHIFT_FONTS
{ "larger-vt-font", HandleLargerFont },
{ "smaller-vt-font", HandleSmallerFont },
@@ -882,21 +897,24 @@ CheckBogusForeground(TScreen * screen, const char *tag)
row = screen->cur_row;
for (; isClear && (row <= screen->max_row); ++row) {
LineData *ld = getLineData(screen, row)->;
- Char *attribs = ld->attribs;
-
- col = (row == screen->cur_row) ? screen->cur_col : 0;
- for (; isClear && (col <= screen->max_col); ++col) {
- unsigned flags = attribs[col];
- if (pass) {
- flags &= ~FG_COLOR;
- attribs[col] = (Char) flags;
- } else if ((flags & BG_COLOR)) {
- isClear = False;
- } else if ((flags & FG_COLOR)) {
- unsigned ch = ld->charData[col];
- isClear = ((ch == ' ') || (ch == 0));
- } else {
- isClear = False;
+
+ if (ld != 0) {
+ Char *attribs = ld->attribs;
+
+ col = (row == screen->cur_row) ? screen->cur_col : 0;
+ for (; isClear && (col <= screen->max_col); ++col) {
+ unsigned flags = attribs[col];
+ if (pass) {
+ flags &= ~FG_COLOR;
+ attribs[col] = (Char) flags;
+ } else if ((flags & BG_COLOR)) {
+ isClear = False;
+ } else if ((flags & FG_COLOR)) {
+ unsigned ch = ld->charData[col];
+ isClear = ((ch == ' ') || (ch == 0));
+ } else {
+ isClear = False;
+ }
}
}
}
@@ -924,9 +942,9 @@ SGR_Foreground(XtermWidget xw, int color)
Pixel fg;
if (color >= 0) {
- xw->flags |= FG_COLOR;
+ UIntSet(xw->flags, FG_COLOR);
} else {
- xw->flags &= ~FG_COLOR;
+ UIntClr(xw->flags, FG_COLOR);
}
fg = getXtermForeground(xw, xw->flags, color);
xw->cur_foreground = color;
@@ -969,9 +987,9 @@ SGR_Background(XtermWidget xw, int color)
FlushScroll(xw);
if (color >= 0) {
- xw->flags |= BG_COLOR;
+ UIntSet(xw->flags, BG_COLOR);
} else {
- xw->flags &= ~BG_COLOR;
+ UIntClr(xw->flags, BG_COLOR);
}
bg = getXtermBackground(xw, xw->flags, color);
xw->cur_background = color;
@@ -1223,7 +1241,7 @@ which_table(Const PARSE_T * table)
/* allocate larger buffer if needed/possible */
#define SafeAlloc(type, area, used, size) \
type *new_string = area; \
- unsigned new_length = size; \
+ size_t new_length = size; \
if (new_length == 0) { \
new_length = 256; \
new_string = TypeMallocN(type, new_length); \
@@ -1556,8 +1574,8 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
SafeAlloc(IChar, sp->print_area, sp->print_used, sp->print_size);
if (new_string == 0) {
fprintf(stderr,
- "Cannot allocate %u bytes for printable text\n",
- new_length);
+ "Cannot allocate %lu bytes for printable text\n",
+ (unsigned long) new_length);
continue;
}
#if OPT_VT52_MODE
@@ -1594,8 +1612,8 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
SafeAlloc(Char, sp->string_area, sp->string_used, sp->string_size);
if (new_string == 0) {
fprintf(stderr,
- "Cannot allocate %u bytes for string mode %d\n",
- new_length, sp->string_mode);
+ "Cannot allocate %lu bytes for string mode %d\n",
+ (unsigned long) new_length, sp->string_mode);
continue;
}
#if OPT_WIDE_CHARS
@@ -2115,8 +2133,8 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
switch (param[row]) {
case DEFAULT:
case 0:
- xw->flags &=
- ~(INVERSE | BOLD | BLINK | UNDERLINE | INVISIBLE);
+ UIntClr(xw->flags,
+ (INVERSE | BOLD | BLINK | UNDERLINE | INVISIBLE));
if_OPT_ISO_COLORS(screen, {
reset_SGR_Colors(xw);
});
@@ -2150,31 +2168,31 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
xw->flags |= INVISIBLE;
break;
case 22: /* reset 'bold' */
- xw->flags &= ~BOLD;
+ UIntClr(xw->flags, BOLD);
if_OPT_ISO_COLORS(screen, {
setExtendedFG(xw);
});
break;
case 24:
- xw->flags &= ~UNDERLINE;
+ UIntClr(xw->flags, UNDERLINE);
if_OPT_ISO_COLORS(screen, {
setExtendedFG(xw);
});
break;
case 25: /* reset 'blink' */
- xw->flags &= ~BLINK;
+ UIntClr(xw->flags, BLINK);
if_OPT_ISO_COLORS(screen, {
setExtendedFG(xw);
});
break;
case 27:
- xw->flags &= ~INVERSE;
+ UIntClr(xw->flags, INVERSE);
if_OPT_ISO_COLORS(screen, {
setExtendedBG(xw);
});
break;
case 28:
- xw->flags &= ~INVISIBLE;
+ UIntClr(xw->flags, INVISIBLE);
break;
case 30:
case 31:
@@ -2495,7 +2513,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_DECKPNM:
TRACE(("CASE_DECKPNM\n"));
- xw->keyboard.flags &= ~MODE_DECKPAM;
+ UIntClr(xw->keyboard.flags, MODE_DECKPAM);
update_appkeypad();
sp->parsestate = sp->groundtable;
break;
@@ -2554,6 +2572,35 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
break;
#endif
+#if OPT_SCROLL_LOCK
+ case CASE_DECLL:
+ TRACE(("CASE_DECLL\n"));
+ if (nparam > 0) {
+ for (count = 0; count < nparam; ++count) {
+ switch (param[count]) {
+ case 0:
+ case DEFAULT:
+ xtermClearLEDs(screen);
+ break;
+ case 1:
+ case 2:
+ case 3:
+ xtermShowLED(screen, (Cardinal) param[count], True);
+ break;
+ case 21:
+ case 22:
+ case 23:
+ xtermShowLED(screen, (Cardinal) (param[count] - 20), True);
+ break;
+ }
+ }
+ } else {
+ xtermClearLEDs(screen);
+ }
+ sp->parsestate = sp->groundtable;
+ break;
+#endif
+
#if OPT_VT52_MODE
case CASE_VT52_FINISH:
TRACE(("CASE_VT52_FINISH terminal_id %d, vtXX_level %d\n",
@@ -2619,7 +2666,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
TRACE(("CASE_DECSCA\n"));
screen->protected_mode = DEC_PROTECT;
if (param[0] <= 0 || param[0] == 2)
- xw->flags &= ~PROTECTED;
+ UIntClr(xw->flags, PROTECTED);
else if (param[0] == 1)
xw->flags |= PROTECTED;
sp->parsestate = sp->groundtable;
@@ -2638,7 +2685,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
break;
case CASE_ST:
- TRACE(("CASE_ST: End of String (%d bytes)\n", sp->string_used));
+ TRACE(("CASE_ST: End of String (%lu bytes)\n", (unsigned long) sp->string_used));
sp->parsestate = sp->groundtable;
if (!sp->string_used)
break;
@@ -2695,7 +2742,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_EPA:
TRACE(("CASE_EPA - end protected area\n"));
- xw->flags &= ~PROTECTED;
+ UIntClr(xw->flags, PROTECTED);
sp->parsestate = sp->groundtable;
break;
@@ -2835,13 +2882,13 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
screen->locator_events |= LOC_BTNS_DN;
break;
case 2:
- screen->locator_events &= ~LOC_BTNS_DN;
+ UIntClr(screen->locator_events, LOC_BTNS_DN);
break;
case 3:
screen->locator_events |= LOC_BTNS_UP;
break;
case 4:
- screen->locator_events &= ~LOC_BTNS_UP;
+ UIntClr(screen->locator_events, LOC_BTNS_UP);
break;
}
}
@@ -3044,12 +3091,12 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
* command-line, allow it to be enabled/disabled by
* control sequence.
*/
- if (!screen->wide_chars) {
- WriteNow();
- ChangeToWide(xw);
- }
if (screen->wide_chars
&& screen->utf8_mode != uAlways) {
+ if (!screen->wide_chars) {
+ WriteNow();
+ ChangeToWide(xw);
+ }
switchPtyData(screen, c == 'G');
TRACE(("UTF8 mode %s\n",
BtoS(screen->utf8_mode)));
@@ -3209,7 +3256,7 @@ static Char *v_bufend; /* end of physical buffer */
/* Write data to the pty as typed by the user, pasted with the mouse,
or generated by us in response to a query ESC sequence. */
-int
+void
v_write(int f, Char * data, unsigned len)
{
int riten;
@@ -3233,11 +3280,15 @@ v_write(int f, Char * data, unsigned len)
#endif
#ifdef VMS
- if ((1 << f) != pty_mask)
- return (tt_write((char *) data, len));
+ if ((1 << f) != pty_mask) {
+ tt_write((char *) data, len);
+ return;
+ }
#else /* VMS */
- if (!FD_ISSET(f, &pty_mask))
- return (write(f, (char *) data, len));
+ if (!FD_ISSET(f, &pty_mask)) {
+ IGNORE_RC(write(f, (char *) data, (size_t) len));
+ return;
+ }
#endif /* VMS */
/*
@@ -3262,7 +3313,7 @@ v_write(int f, Char * data, unsigned len)
fprintf(stderr, "moving data down %d\n",
v_bufstr - v_buffer);
#endif
- memmove(v_buffer, v_bufstr, (unsigned) (v_bufptr - v_bufstr));
+ memmove(v_buffer, v_bufstr, (size_t) (v_bufptr - v_bufstr));
v_bufptr -= v_bufstr - v_buffer;
v_bufstr = v_buffer;
}
@@ -3291,7 +3342,7 @@ v_write(int f, Char * data, unsigned len)
}
if (v_bufend >= v_bufptr + len) {
/* new stuff will fit */
- memmove(v_bufptr, data, len);
+ memmove(v_bufptr, data, (size_t) len);
v_bufptr += len;
}
}
@@ -3322,10 +3373,10 @@ v_write(int f, Char * data, unsigned len)
if (riten == 0)
return (riten);
#else /* VMS */
- riten = write(f, v_bufstr,
- (size_t) ((v_bufptr - v_bufstr <= MAX_PTY_WRITE)
- ? v_bufptr - v_bufstr
- : MAX_PTY_WRITE));
+ riten = (int) write(f, v_bufstr,
+ (size_t) ((v_bufptr - v_bufstr <= MAX_PTY_WRITE)
+ ? v_bufptr - v_bufstr
+ : MAX_PTY_WRITE));
if (riten < 0)
#endif /* VMS */
{
@@ -3352,8 +3403,8 @@ v_write(int f, Char * data, unsigned len)
*/
if (v_bufend - v_bufptr > 1024) { /* arbitrary hysteresis */
/* save pointers across realloc */
- int start = v_bufstr - v_buffer;
- int size = v_bufptr - v_buffer;
+ int start = (int) (v_bufstr - v_buffer);
+ int size = (int) (v_bufptr - v_buffer);
unsigned allocsize = (unsigned) (size ? size : 1);
v_buffer = TypeRealloc(Char, allocsize, v_buffer);
@@ -3370,7 +3421,6 @@ v_write(int f, Char * data, unsigned len)
v_buffer = v_bufstr - start; /* restore clobbered pointer */
}
}
- return ((int) c);
}
#ifdef VMS
@@ -3424,7 +3474,7 @@ in_put(XtermWidget xw)
&& screen->scrollttyoutput
&& screen->topline < 0)
/* Scroll to bottom */
- WindowScroll(xw, 0);
+ WindowScroll(xw, 0, False);
break;
}
if (screen->scroll_amt)
@@ -3497,10 +3547,10 @@ in_put(XtermWidget xw)
if (screen->scrollWidget
&& screen->scrollttyoutput
&& screen->topline < 0)
- WindowScroll(xw, 0); /* Scroll to bottom */
+ WindowScroll(xw, 0, False); /* Scroll to bottom */
/* stop speed reading at some point to look for X stuff */
- TRACE(("VTbuffer uses %d/%d\n",
- VTbuffer->last - VTbuffer->buffer,
+ TRACE(("VTbuffer uses %ld/%d\n",
+ (long) (VTbuffer->last - VTbuffer->buffer),
BUF_SIZE));
if ((VTbuffer->last - VTbuffer->buffer) > BUF_SIZE) {
FD_CLR(screen->respond, &select_mask);
@@ -5270,7 +5320,7 @@ SwitchBufPtrs(TScreen * screen, int toBuf GCC_UNUSED)
#if OPT_SAVE_LINES
screen->visbuf = screen->editBuf_index[toBuf];
#else
- size_t len = ScrnPointers(screen, (unsigned) MaxRows(screen));
+ size_t len = ScrnPointers(screen, (size_t) MaxRows(screen));
memcpy(screen->save_ptr, screen->visbuf, len);
memcpy(screen->visbuf, screen->editBuf_index[1], len);
@@ -5305,7 +5355,7 @@ VTRun(XtermWidget xw)
#if OPT_TEK4014
if (Tpushb > Tpushback) {
- fillPtyData(screen, VTbuffer, (char *) Tpushback, Tpushb - Tpushback);
+ fillPtyData(screen, VTbuffer, (char *) Tpushback, (int) (Tpushb - Tpushback));
Tpushb = Tpushback;
}
#endif
@@ -5588,7 +5638,7 @@ fill_Tres(XtermWidget target, XtermWidget source, int offset)
: TScreenOf(target)->Tcolors[TEXT_BG].value);
} else {
memset(&temp, 0, sizeof(temp));
- if (AllocateTermColor(target, &temp, offset, name)) {
+ if (AllocateTermColor(target, &temp, offset, name, True)) {
if (COLOR_DEFINED(&(temp), offset))
free(temp.names[offset]);
TScreenOf(target)->Tcolors[offset].value = temp.colors[offset];
@@ -5689,12 +5739,12 @@ VTInitialize_locale(XtermWidget xw)
#ifdef MB_CUR_MAX
MB_CUR_MAX > 1 ||
#else
- !strncmp(xtermEnvLocale(), "ja", 2) ||
- !strncmp(xtermEnvLocale(), "ko", 2) ||
- !strncmp(xtermEnvLocale(), "zh", 2) ||
+ !strncmp(xtermEnvLocale(), "ja", (size_t) 2) ||
+ !strncmp(xtermEnvLocale(), "ko", (size_t) 2) ||
+ !strncmp(xtermEnvLocale(), "zh", (size_t) 2) ||
#endif
- !strncmp(xtermEnvLocale(), "th", 2) ||
- !strncmp(xtermEnvLocale(), "vi", 2)) {
+ !strncmp(xtermEnvLocale(), "th", (size_t) 2) ||
+ !strncmp(xtermEnvLocale(), "vi", (size_t) 2)) {
xw->misc.callfilter = 1;
screen->utf8_mode = uAlways;
} else {
@@ -5773,7 +5823,7 @@ ParseList(const char **source)
{
const char *base = *source;
const char *next;
- unsigned size;
+ size_t size;
char *value = 0;
char *result;
@@ -5784,7 +5834,7 @@ ParseList(const char **source)
next = base;
while (*next != '\0' && *next != ',')
++next;
- size = (unsigned) (1 + next - base);
+ size = (size_t) (1 + next - base);
value = malloc(size);
if (value != 0) {
memcpy(value, base, size);
@@ -6137,6 +6187,10 @@ VTInitialize(Widget wrequest,
init_Bres(screen.allowTitleOp0);
init_Bres(screen.allowWindowOp0);
+#if OPT_SCROLL_LOCK
+ init_Bres(screen.allowScrollLock0);
+#endif
+
init_Sres(screen.disallowedColorOps);
set_flags_from_list(TScreenOf(wnew)->disallow_color_ops,
@@ -6179,6 +6233,10 @@ VTInitialize(Widget wrequest,
TScreenOf(wnew)->allowTitleOps = TScreenOf(wnew)->allowTitleOp0;
TScreenOf(wnew)->allowWindowOps = TScreenOf(wnew)->allowWindowOp0;
+#if OPT_SCROLL_LOCK
+ TScreenOf(wnew)->allowScrollLock = TScreenOf(wnew)->allowScrollLock0;
+#endif
+
init_Bres(screen.quiet_grab);
#ifndef NO_ACTIVE_ICON
@@ -6479,11 +6537,7 @@ VTInitialize(Widget wrequest,
TRACE(("initialized unicode_font to %d\n", TScreenOf(wnew)->unicode_font));
#endif
- decode_wcwidth((wnew->misc.cjk_width ? 2 : 0)
- + (wnew->misc.mk_width ? 1 : 0)
- + 1,
- wnew->misc.mk_samplesize,
- wnew->misc.mk_samplepass);
+ decode_wcwidth(wnew);
#endif /* OPT_WIDE_CHARS */
init_Bres(screen.always_bold_mode);
@@ -6716,16 +6770,38 @@ VTDestroy(Widget w GCC_UNUSED)
}
#endif
-#if 0 /* some strings may be owned by X libraries */
- for (n = 0; n <= fontMenu_lastBuiltin; ++n) {
- int k;
- for (k = 0; k < fMAX; ++k) {
- char *s = screen->menu_font_names[n][k];
- if (s != 0)
- free(s);
- }
+ /* free things allocated via init_Sres or Init_Sres2 */
+#ifdef ALLOWLOGGING
+ TRACE_FREE_LEAK(screen->logfile);
+#endif
+ TRACE_FREE_LEAK(screen->term_id);
+ TRACE_FREE_LEAK(screen->charClass);
+ TRACE_FREE_LEAK(screen->answer_back);
+ TRACE_FREE_LEAK(screen->printer_command);
+ TRACE_FREE_LEAK(screen->keyboard_dialect);
+ TRACE_FREE_LEAK(screen->disallowedColorOps);
+ TRACE_FREE_LEAK(screen->disallowedFontOps);
+ TRACE_FREE_LEAK(screen->disallowedTcapOps);
+ TRACE_FREE_LEAK(screen->disallowedWinOps);
+ TRACE_FREE_LEAK(screen->default_string);
+ TRACE_FREE_LEAK(screen->eightbit_select_types);
+#if OPT_WIDE_CHARS
+ TRACE_FREE_LEAK(screen->utf8_select_types);
+#endif
+#if 0
+ for (n = fontMenu_font1; n <= fontMenu_lastBuiltin; n++) {
+ TRACE_FREE_LEAK(screen->MenuFontName(n));
}
#endif
+ TRACE_FREE_LEAK(screen->initial_font);
+#if OPT_LUIT_PROG
+ TRACE_FREE_LEAK(xw->misc.locale_str);
+ TRACE_FREE_LEAK(xw->misc.localefilter);
+#endif
+#if OPT_RENDERFONT
+ TRACE_FREE_LEAK(xw->misc.face_name);
+ TRACE_FREE_LEAK(xw->misc.face_wide_name);
+#endif
#if OPT_SELECT_REGEX
for (n = 0; n < NSELECTUNITS; ++n) {
@@ -7138,7 +7214,7 @@ xim_real_init(XtermWidget xw)
screen->xim = XOpenIM(XtDisplay(xw), NULL, NULL, NULL);
} else {
s = xw->misc.input_method;
- i = 5 + strlen(s);
+ i = 5 + (unsigned) strlen(s);
t = (char *) MyStackAlloc(i, buf);
if (t == NULL)
SysError(ERROR_VINIT);
@@ -7155,7 +7231,7 @@ xim_real_init(XtermWidget xw)
if (end != s) {
strcpy(t, "@im=");
- strncat(t, s, (unsigned) (end - s));
+ strncat(t, s, (size_t) (end - s));
if ((p = XSetLocaleModifiers(t)) != 0 && *p
&& (screen->xim = XOpenIM(XtDisplay(xw),
@@ -7205,10 +7281,10 @@ xim_real_init(XtermWidget xw)
end--;
if (end != s) { /* just in case we have a spurious comma */
- TRACE(("looking for style '%.*s'\n", end - s, s));
+ TRACE(("looking for style '%.*s'\n", (int) (end - s), s));
for (i = 0; i < XtNumber(known_style); i++) {
if ((int) strlen(known_style[i].name) == (end - s)
- && !strncmp(s, known_style[i].name, (unsigned) (end - s))) {
+ && !strncmp(s, known_style[i].name, (size_t) (end - s))) {
input_style = known_style[i].code;
for (j = 0; j < xim_styles->count_styles; j++) {
if (input_style == xim_styles->supported_styles[j]) {
@@ -7915,7 +7991,7 @@ HandleBlinking(XtPointer closure, XtIntervalId * id GCC_UNUSED)
#if OPT_BLINK_TEXT
/*
- * Inspect the line on the current screen to see if any have the BLINK flag
+ * Inspect the lines on the current screen to see if any have the BLINK flag
* associated with them. Prune off any that have had the corresponding
* cells reset. If any are left, repaint those lines with ScrnRefresh().
*/
@@ -7926,7 +8002,8 @@ HandleBlinking(XtPointer closure, XtIntervalId * id GCC_UNUSED)
for (row = screen->max_row; row >= 0; row--) {
LineData *ld = getLineData(screen, ROW2INX(screen, row));
- if (LineTstBlinked(ld)) {
+
+ if (ld != 0 && LineTstBlinked(ld)) {
if (LineHasBlinking(screen, ld)) {
resume = True;
if (row > last_row)
@@ -7979,7 +8056,8 @@ RestartBlinking(TScreen * screen GCC_UNUSED)
for (row = screen->max_row; row >= 0; row--) {
LineData *ld = getLineData(screen, ROW2INX(screen, row));
- if (LineTstBlinked(ld)) {
+
+ if (ld != 0 && LineTstBlinked(ld)) {
if (LineHasBlinking(screen, ld)) {
resume = True;
break;
@@ -8121,7 +8199,7 @@ VTReset(XtermWidget xw, Bool full, Bool saved)
* We reset autowrap to the resource values rather than turning
* it off.
*/
- xw->keyboard.flags &= ~(MODE_DECCKM | MODE_KAM | MODE_DECKPAM);
+ UIntClr(xw->keyboard.flags, (MODE_DECCKM | MODE_KAM | MODE_DECKPAM));
bitcpy(&xw->flags, xw->initflags, WRAPAROUND | REVERSEWRAP);
bitclr(&xw->flags, INSERT | INVERSE | BOLD | BLINK | UNDERLINE | INVISIBLE);
if_OPT_ISO_COLORS(screen, {
@@ -8353,7 +8431,7 @@ DoSetSelectedFont(Widget w,
char *val;
char *test = 0;
char *used = 0;
- unsigned len = *length;
+ unsigned len = (unsigned) *length;
unsigned tst;
/*
@@ -8367,7 +8445,7 @@ DoSetSelectedFont(Widget w,
}
if (len > 0 && (val = TypeMallocN(char, len + 1)) != 0) {
- memcpy(val, value, len);
+ memcpy(val, value, (size_t) len);
val[len] = '\0';
used = x_strtrim(val);
TRACE(("DoSetSelectedFont(%s)\n", val));
@@ -8426,7 +8504,8 @@ FindFontSelection(XtermWidget xw, const char *atom_name, Bool justprobe)
}
if (!a) {
atoms = (AtomPtr *) XtRealloc((char *) atoms,
- sizeof(AtomPtr) * (atomCount + 1));
+ (Cardinal) sizeof(AtomPtr)
+ * (atomCount + 1));
*(pAtom = &atoms[atomCount++]) = XmuMakeAtom(atom_name);
}
diff --git a/app/xterm/configure.in b/app/xterm/configure.in
index 63f7c753a..33ea78102 100644
--- a/app/xterm/configure.in
+++ b/app/xterm/configure.in
@@ -1,4 +1,4 @@
-dnl $XTermId: configure.in,v 1.256 2010/01/04 21:41:10 tom Exp $
+dnl $XTermId: configure.in,v 1.262 2010/04/21 00:16:24 tom Exp $
dnl
dnl -----------------------------------------------------------------------------
dnl this file is part of xterm
@@ -280,7 +280,9 @@ AC_CHECK_HEADERS( \
X11/DECkeysym.h \
X11/Sunkeysym.h \
X11/XF86keysym.h \
+ X11/XKBlib.h \
X11/Xpoll.h \
+ X11/extensions/XKB.h \
)
CF_X_ATHENA
@@ -300,7 +302,10 @@ freebsd*|netbsd*|dragonfly*) # 2004/8/15 - revisit this if/when grantpt is known
;;
esac
+AC_CHECK_FUNCS(XkbQueryExtension)
+
CF_XKB_BELL_EXT
+
AC_CHECK_FUNCS(Xutf8LookupString, [],[
EXTRAHDRS="$EXTRAHDRS xutf8.h"
EXTRASRCS="$EXTRASRCS xutf8.c"
@@ -583,7 +588,7 @@ fi
AC_MSG_CHECKING(if you want saved-lines stored as a FIFO)
CF_ARG_DISABLE(fifo-lines,
- [ --enable-fifo-lines disable FIFO-storage for saved-lines],
+ [ --disable-fifo-lines disable FIFO-storage for saved-lines],
[enable_fifo_lines=no],
[enable_fifo_lines=yes])
AC_MSG_RESULT($enable_fifo_lines)
@@ -981,5 +986,8 @@ do
CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-D$cf_def//`
done
+CF_MAKE_TAGS
+CF_DISABLE_RPATH_HACK
+
### output Makefile and xtermcfg.h
AC_OUTPUT(Makefile)
diff --git a/app/xterm/ctlseqs.ms b/app/xterm/ctlseqs.ms
index 0ba3a2548..58c90aab7 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.211 2010/01/04 09:12:55 tom Exp $
+.\" $XTermId: ctlseqs.ms,v 1.213 2010/04/18 14:52:50 Emanuele.Giaquinta Exp $
.\"
.\"
.\" Copyright 1996-2009,2010 by Thomas E. Dickey
@@ -1085,6 +1085,16 @@ Valid values for the second parameter:
\*(Ps = \*1 \(-> 7-bit controls (always set for VT100)
\*(Ps = \*2 \(-> 8-bit controls
.
+.IP \\*(Cs\\*(Ps\\*s\\*q
+Load LEDs (DECLL)
+ \*(Ps = \*0 \(-> Clear all LEDS (default)
+ \*(Ps = \*1 \(-> Light Num Lock
+ \*(Ps = \*2 \(-> Light Caps Lock
+ \*(Ps = \*3 \(-> Light Scroll Lock
+ \*(Ps = \*2 \*1 \(-> Extinguish Num Lock
+ \*(Ps = \*2 \*2 \(-> Extinguish Caps Lock
+ \*(Ps = \*2 \*3 \(-> Extinguish Scroll Lock
+.
.IP \\*(Cs\\*(Ps\\*s\\*(Sp\\*q
Set cursor style (DECSCUSR, VT520)
\*(Ps = \*0 \(-> blinking block
@@ -1375,8 +1385,9 @@ be given in one control sequence, \fBxterm\fR can make more than one reply.
\*(Ps = \*1\*4 \(-> Change mouse background color to \*(Pt
\*(Ps = \*1\*5 \(-> Change Tektronix foreground color to \*(Pt
\*(Ps = \*1\*6 \(-> Change Tektronix background color to \*(Pt
- \*(Ps = \*1\*7 \(-> Change highlight color to \*(Pt
+ \*(Ps = \*1\*7 \(-> Change highlight background color to \*(Pt
\*(Ps = \*1\*8 \(-> Change Tektronix cursor color to \*(Pt
+ \*(Ps = \*1\*9 \(-> Change highlight foreground color to \*(Pt
.sp
\*(Ps = \*4\*6 \(-> Change Log File to \*(Pt (normally disabled by a
compile-time option)
diff --git a/app/xterm/ctlseqs.txt b/app/xterm/ctlseqs.txt
index d6595be45..9da44691f 100644
--- a/app/xterm/ctlseqs.txt
+++ b/app/xterm/ctlseqs.txt
@@ -599,6 +599,14 @@ CSI Ps ; Ps " p
Ps = 0 -> 8-bit controls
Ps = 1 -> 7-bit controls (always set for VT100)
Ps = 2 -> 8-bit controls
+CSI Ps q Load LEDs (DECLL)
+ Ps = 0 -> Clear all LEDS (default)
+ Ps = 1 -> Light Num Lock
+ Ps = 2 -> Light Caps Lock
+ Ps = 3 -> Light Scroll Lock
+ Ps = 2 1 -> Extinguish Num Lock
+ Ps = 2 2 -> Extinguish Caps Lock
+ Ps = 2 3 -> Extinguish Scroll Lock
CSI Ps SP q
Set cursor style (DECSCUSR, VT520)
Ps = 0 -> blinking block
@@ -859,8 +867,9 @@ OSC Ps ; Pt BEL
Ps = 1 4 -> Change mouse background color to Pt
Ps = 1 5 -> Change Tektronix foreground color to Pt
Ps = 1 6 -> Change Tektronix background color to Pt
- Ps = 1 7 -> Change highlight color to Pt
+ Ps = 1 7 -> Change highlight background color to Pt
Ps = 1 8 -> Change Tektronix cursor color to Pt
+ Ps = 1 9 -> Change highlight foreground color to Pt
Ps = 4 6 -> Change Log File to Pt (normally disabled by a
compile-time option)
diff --git a/app/xterm/cursor.c b/app/xterm/cursor.c
index 2c5b1892c..e25a9f801 100644
--- a/app/xterm/cursor.c
+++ b/app/xterm/cursor.c
@@ -1,7 +1,7 @@
-/* $XTermId: cursor.c,v 1.54 2009/11/28 13:26:13 tom Exp $ */
+/* $XTermId: cursor.c,v 1.55 2010/04/17 17:12:01 tom Exp $ */
/*
- * Copyright 2002-2008,2009 by Thomas E. Dickey
+ * Copyright 2002-2009,2010 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -310,8 +310,8 @@ CursorRestore(XtermWidget xw)
resetCharsets(screen);
}
- xw->flags &= ~DECSC_FLAGS;
- xw->flags |= sc->flags & DECSC_FLAGS;
+ UIntClr(xw->flags, DECSC_FLAGS);
+ UIntSet(xw->flags, sc->flags & DECSC_FLAGS);
CursorSet(screen,
((xw->flags & ORIGIN)
? sc->row - screen->top_marg
diff --git a/app/xterm/doublechr.c b/app/xterm/doublechr.c
index bcfcddae3..210a41ab8 100644
--- a/app/xterm/doublechr.c
+++ b/app/xterm/doublechr.c
@@ -1,4 +1,4 @@
-/* $XTermId: doublechr.c,v 1.73 2009/11/28 13:28:03 tom Exp $ */
+/* $XTermId: doublechr.c,v 1.74 2010/04/16 08:45:59 tom Exp $ */
/************************************************************
@@ -293,7 +293,7 @@ xterm_DoubleGC(XtermWidget xw,
result = getCgsGC(xw, cgsWin, cgsId);
*inxp = n;
} else if (flags & BOLD) {
- flags &= ~BOLD;
+ UIntClr(flags, BOLD);
result = xterm_DoubleGC(xw, chrset, flags, old_gc, inxp);
}
}
diff --git a/app/xterm/fontutils.c b/app/xterm/fontutils.c
index 8e964f452..33d64e45b 100644
--- a/app/xterm/fontutils.c
+++ b/app/xterm/fontutils.c
@@ -1,4 +1,4 @@
-/* $XTermId: fontutils.c,v 1.336 2010/01/01 15:02:26 tom Exp $ */
+/* $XTermId: fontutils.c,v 1.340 2010/04/18 16:48:46 tom Exp $ */
/************************************************************
@@ -261,17 +261,20 @@ get_font_name_props(Display * dpy, XFontStruct * fs, char *result)
XFontProp *fp;
int i;
Atom fontatom = XInternAtom(dpy, "FONT", False);
- char *name;
+ char *name = 0;
char *str;
/*
* first get the full font name
*/
- for (name = 0, i = 0, fp = fs->properties;
- i < fs->n_properties;
- i++, fp++)
- if (fp->name == fontatom)
- name = XGetAtomName(dpy, fp->card32);
+ if (fontatom != 0) {
+ for (i = 0, fp = fs->properties; i < fs->n_properties; i++, fp++) {
+ if (fp->name == fontatom) {
+ name = XGetAtomName(dpy, fp->card32);
+ break;
+ }
+ }
+ }
if (name == 0)
return 0;
@@ -700,11 +703,13 @@ is_double_width_font_xft(Display * dpy, XftFont * font)
* (fs)->max_bounds.width)
const VTFontNames *
-xtermFontName(char *normal)
+xtermFontName(const char *normal)
{
static VTFontNames data;
+ if (data.f_n)
+ free(data.f_n);
memset(&data, 0, sizeof(data));
- data.f_n = normal;
+ data.f_n = x_strdup(normal);
return &data;
}
@@ -1198,7 +1203,7 @@ xtermLoadFont(XtermWidget xw,
set_menu_font(True);
if (tmpname) { /* if setting escape or sel */
if (screen->MenuFontName(fontnum))
- free(screen->MenuFontName(fontnum));
+ free((void *) screen->MenuFontName(fontnum));
screen->MenuFontName(fontnum) = tmpname;
if (fontnum == fontMenu_fontescape) {
SetItemSensitivity(fontMenuEntries[fontMenu_fontescape].widget,
@@ -1417,8 +1422,8 @@ HandleLoadVTFonts(Widget w,
if ((xw = getXtermWidget(w)) != 0) {
TScreen *screen = TScreenOf(xw);
char buf[80];
- char *myName = (*param_count > 0) ? params[0] : empty;
- char *convert = (*param_count > 1) ? params[1] : myName;
+ char *myName = (char *) ((*param_count > 0) ? params[0] : empty);
+ char *convert = (char *) ((*param_count > 1) ? params[1] : myName);
char *myClass = (char *) MyStackAlloc(strlen(convert), buf);
int n;
@@ -1748,7 +1753,7 @@ getFaceName(XtermWidget xw, Bool wideName GCC_UNUSED)
#else
char *result = xw->misc.face_name;
#endif
- if (!IsEmpty(result) && !strncmp(result, "xft:", 4))
+ if (!IsEmpty(result) && !strncmp(result, "xft:", (size_t) 4))
result += 4;
return x_nonempty(result);
}
@@ -1835,15 +1840,15 @@ xtermComputeFontInfo(XtermWidget xw,
face_size = 14.0;
} else {
double ratio;
- int num = screen->menu_font_sizes[fontnum];
- int den = screen->menu_font_sizes[0];
+ long num = screen->menu_font_sizes[fontnum];
+ long den = screen->menu_font_sizes[0];
if (den <= 0)
den = 1;
- ratio = mySquareRoot((1.0 * num) / den);
+ ratio = mySquareRoot((double) num / (double) den);
face_size = (ratio * xw->misc.face_size[0]);
- TRACE(("scaled using %3d/%d = %.2f -> %f\n",
+ TRACE(("scaled using %3ld/%ld = %.2f -> %f\n",
num, den, ratio, face_size));
}
#else
@@ -2689,7 +2694,7 @@ useFaceSizes(XtermWidget xw)
if (!result) {
Boolean broken_fonts = True;
TScreen *screen = TScreenOf(xw);
- int first = screen->menu_font_sizes[0];
+ long first = screen->menu_font_sizes[0];
lookupFontSizes(xw);
for (n = 0; n < NMENUFONTS; n++) {
diff --git a/app/xterm/fontutils.h b/app/xterm/fontutils.h
index 9d8927cfe..383380343 100644
--- a/app/xterm/fontutils.h
+++ b/app/xterm/fontutils.h
@@ -1,4 +1,4 @@
-/* $XTermId: fontutils.h,v 1.79 2009/12/31 13:31:52 tom Exp $ */
+/* $XTermId: fontutils.h,v 1.80 2010/04/16 21:23:13 tom Exp $ */
/************************************************************
@@ -40,7 +40,7 @@ authorization.
extern Bool xtermLoadDefaultFonts (XtermWidget /* xw */);
extern Bool xtermOpenFont (XtermWidget /* xw */, const char */* name */, XTermFonts * /* result */, fontWarningTypes /* warn */, Bool /* force */);
extern XTermFonts * xtermCloseFont (XtermWidget /* xw */, XTermFonts * /* fnt */);
-extern const VTFontNames * xtermFontName (char */* normal */);
+extern const VTFontNames * xtermFontName (const char */* normal */);
extern int lookupRelativeFontSize (XtermWidget /* xw */, int /* old */, int /* relative */);
extern int xtermGetFont(const char * /* param */);
extern int xtermLoadFont (XtermWidget /* xw */, const VTFontNames */* fonts */, Bool /* doresize */, int /* fontnum */);
diff --git a/app/xterm/input.c b/app/xterm/input.c
index ea8d825c1..f4f579cff 100644
--- a/app/xterm/input.c
+++ b/app/xterm/input.c
@@ -1,7 +1,7 @@
-/* $XTermId: input.c,v 1.312 2009/12/29 23:45:29 tom Exp $ */
+/* $XTermId: input.c,v 1.324 2010/04/18 17:50:52 tom Exp $ */
/*
- * Copyright 1999-2008,2009 by Thomas E. Dickey
+ * Copyright 1999-2009,2010 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -181,7 +181,7 @@ AdjustAfterInput(XtermWidget xw)
TScreen *screen = TScreenOf(xw);
if (screen->scrollkey && screen->topline != 0)
- WindowScroll(xw, 0);
+ WindowScroll(xw, 0, False);
if (screen->marginbell) {
int col = screen->max_col - screen->nmarginbell;
if (screen->bellArmed >= 0) {
@@ -355,13 +355,13 @@ xtermParamToState(XtermWidget xw, unsigned param)
| xw->misc.alt_mods
| xw->misc.meta_mods) & xw->misc.other_mods) == 0) {
if ((param - MOD_NONE) & MOD_SHIFT)
- result |= ShiftMask;
+ UIntSet(result, ShiftMask);
if ((param - MOD_NONE) & MOD_CTRL)
- result |= ControlMask;
+ UIntSet(result, ControlMask);
if ((param - MOD_NONE) & MOD_ALT)
- result |= xw->misc.alt_mods;
+ UIntSet(result, xw->misc.alt_mods);
if ((param - MOD_NONE) & MOD_META)
- result |= xw->misc.meta_mods;
+ UIntSet(result, xw->misc.meta_mods);
}
#else
(void) xw;
@@ -386,19 +386,19 @@ xtermStateToParam(XtermWidget xw, unsigned state)
if ((state & xw->misc.other_mods) == 0) {
if (state & ShiftMask) {
modify_parm += MOD_SHIFT;
- state &= ~ShiftMask;
+ UIntClr(state, ShiftMask);
}
if (state & ControlMask) {
modify_parm += MOD_CTRL;
- state &= ~ControlMask;
+ UIntClr(state, ControlMask);
}
if ((state & xw->misc.alt_mods) != 0) {
modify_parm += MOD_ALT;
- state &= ~xw->misc.alt_mods;
+ UIntClr(state, xw->misc.alt_mods);
}
if ((state & xw->misc.meta_mods) != 0) {
modify_parm += MOD_META;
- state &= ~xw->misc.meta_mods;
+ UIntClr(state, xw->misc.meta_mods);
}
}
if (modify_parm == MOD_NONE)
@@ -483,7 +483,7 @@ allowedCharModifiers(XtermWidget xw, unsigned state, KEY_DATA * kd)
&& Masked(result, ControlMask) == 0) {
/* These keys are already associated with the control-key */
if (xw->keyboard.modify_now.other_keys == 0) {
- result &= ~ControlMask;
+ UIntClr(result, ControlMask);
}
} else if (kd->keysym == XK_Tab || kd->keysym == XK_Return) {
;
@@ -495,7 +495,7 @@ allowedCharModifiers(XtermWidget xw, unsigned state, KEY_DATA * kd)
} else if (!IsControlOutput(kd) && !IsPredefinedKey(kd->keysym)) {
/* Printable keys are already associated with the shift-key */
if (!(result & ControlMask)) {
- result &= ~ShiftMask;
+ UIntClr(result, ShiftMask);
}
}
#if OPT_NUM_LOCK
@@ -548,7 +548,7 @@ ModifyOtherKeys(XtermWidget xw,
} else if (modify_parm != 0) {
if (IsBackarrowToggle(keyboard, kd->keysym, state)) {
kd->keysym = XK_Delete;
- state &= ~ControlMask;
+ UIntClr(state, ControlMask);
}
if (!IsPredefinedKey(kd->keysym)) {
state = allowedCharModifiers(xw, state, kd);
@@ -836,13 +836,13 @@ Input(XtermWidget xw,
#if OPT_WIDE_CHARS
if (screen->utf8_mode) {
kd.nbytes = Xutf8LookupString(screen->xic, event,
- kd.strbuf, sizeof(kd.strbuf),
+ kd.strbuf, (int) sizeof(kd.strbuf),
&kd.keysym, &status_return);
} else
#endif
{
kd.nbytes = XmbLookupString(screen->xic, event,
- kd.strbuf, sizeof(kd.strbuf),
+ kd.strbuf, (int) sizeof(kd.strbuf),
&kd.keysym, &status_return);
}
#if OPT_MOD_FKEYS
@@ -863,7 +863,7 @@ Input(XtermWidget xw,
{
static XComposeStatus compose_status =
{NULL, 0};
- kd.nbytes = XLookupString(event, kd.strbuf, sizeof(kd.strbuf),
+ kd.nbytes = XLookupString(event, kd.strbuf, (int) sizeof(kd.strbuf),
&kd.keysym, &compose_status);
}
kd.is_fkey = IsFunctionKey(kd.keysym);
@@ -899,7 +899,7 @@ Input(XtermWidget xw,
&& (evt_state & ShiftMask) == 0) {
if (kd.keysym == XK_KP_Add) {
kd.keysym = XK_KP_Separator;
- evt_state &= ~ShiftMask;
+ UIntClr(evt_state, ShiftMask);
TRACE(("...Input keypad(+), change keysym to "
KEYSYM_FMT
"\n",
@@ -908,7 +908,7 @@ Input(XtermWidget xw,
if ((evt_state & ControlMask) != 0
&& kd.keysym == XK_KP_Separator) {
kd.keysym = XK_KP_Subtract;
- evt_state &= ~ControlMask;
+ UIntClr(evt_state, ControlMask);
TRACE(("...Input control/keypad(,), change keysym to "
KEYSYM_FMT
"\n",
@@ -1022,7 +1022,7 @@ Input(XtermWidget xw,
TRACE(("...map XK_F%ld", kd.keysym - XK_Fn(1) + 1));
if (evt_state & ControlMask) {
kd.keysym += (KeySym) xw->misc.ctrl_fkeys;
- evt_state &= ~ControlMask;
+ UIntClr(evt_state, ControlMask);
}
TRACE((" to XK_F%ld\n", kd.keysym - XK_Fn(1) + 1));
@@ -1033,11 +1033,11 @@ Input(XtermWidget xw,
TRACE(("...map XK_F%ld", kd.keysym - XK_Fn(1) + 1));
if (evt_state & ShiftMask) {
kd.keysym += (KeySym) (xw->misc.ctrl_fkeys * 1);
- evt_state &= ~ShiftMask;
+ UIntClr(evt_state, ShiftMask);
}
if (evt_state & ControlMask) {
kd.keysym += (KeySym) (xw->misc.ctrl_fkeys * 2);
- evt_state &= ~ControlMask;
+ UIntClr(evt_state, ControlMask);
}
TRACE((" to XK_F%ld\n", kd.keysym - XK_Fn(1) + 1));
@@ -1105,7 +1105,7 @@ Input(XtermWidget xw,
&& keyboard->type == keyboardIsVT220
#endif
&& ((string = (Char *) udk_lookup(dec_code, &kd.nbytes)) != 0)) {
- evt_state &= ~ShiftMask;
+ UIntClr(evt_state, ShiftMask);
while (kd.nbytes-- > 0)
unparseputc(xw, CharOf(*string++));
}
@@ -1240,7 +1240,7 @@ Input(XtermWidget xw,
if (screen->meta_sends_esc
&& (evt_state & xw->misc.meta_mods) != 0) {
TRACE(("...input-char is modified by META\n"));
- evt_state &= ~xw->misc.meta_mods;
+ UIntClr(evt_state, xw->misc.meta_mods);
eightbit = False;
prefix = ANSI_ESC;
} else if (eightbit) {
@@ -1249,7 +1249,7 @@ Input(XtermWidget xw,
}
if (screen->alt_is_not_meta
&& (evt_state & xw->misc.alt_mods) != 0) {
- evt_state &= ~xw->misc.alt_mods;
+ UIntClr(evt_state, xw->misc.alt_mods);
if (screen->alt_sends_esc) {
TRACE(("...input-char is modified by ALT\n"));
eightbit = False;
@@ -1318,7 +1318,7 @@ Input(XtermWidget xw,
} else if (kd.strbuf[0] == '?'
&& (evt_state & ControlMask) != 0) {
kd.strbuf[0] = ANSI_DEL;
- evt_state &= ~ControlMask;
+ UIntClr(evt_state, ControlMask);
}
}
if (prefix != 0)
@@ -1326,7 +1326,7 @@ Input(XtermWidget xw,
for (j = 0; j < kd.nbytes; ++j)
unparseputc(xw, CharOf(kd.strbuf[j]));
}
- key = True;
+ key = ((kd.keysym != ANSI_XOFF) && (kd.keysym != ANSI_XON));
}
unparse_end(xw);
@@ -1340,9 +1340,9 @@ Input(XtermWidget xw,
void
StringInput(XtermWidget xw, Char * string, size_t nbytes)
{
- TRACE(("InputString (%s,%d)\n",
- visibleChars(string, nbytes),
- nbytes));
+ TRACE(("InputString (%s,%lu)\n",
+ visibleChars(string, (unsigned) nbytes),
+ (unsigned long) nbytes));
#if OPT_TEK4014
if (nbytes && TEK4014_GIN(tekWidget)) {
TekEnqMouse(tekWidget, *string++);
@@ -1665,14 +1665,95 @@ sunfuncvalue(ANSI * reply, KEY_DATA * kd)
}
#if OPT_NUM_LOCK
-#define isName(c) ((c) == '_' || isalnum(CharOf(c)))
+#define isName(c) ((c) == '_' || (c) == '-' || isalnum(CharOf(c)))
+
+static const char *
+skipName(const char *s)
+{
+ while (*s != '\0' && isName(CharOf(*s)))
+ ++s;
+ return s;
+}
+
+/*
+ * Found a ":" in a translation, check what is past it to see if it contains
+ * any of the insert-text action names.
+ */
+static Boolean
+keyCanInsert(const char *parse)
+{
+ Boolean result = False;
+ int ch;
+ Boolean escape = False;
+ Boolean quoted = False;
+
+ static const char *table[] =
+ {
+ "insert",
+ "insert-seven-bit",
+ "insert-eight-bit",
+ "string",
+ };
+ Cardinal n;
+
+ while (*parse != '\0' && *parse != '\n') {
+ ch = CharOf(*parse++);
+ if (escape) {
+ escape = False;
+ } else if (ch == '\\') {
+ escape = True;
+ } else if (ch == '"') {
+ quoted = (Boolean) ! quoted;
+ } else if (!quoted && isName(ch)) {
+ const char *next = skipName(--parse);
+ size_t need = (size_t) (next - parse);
+
+ for (n = 0; n < XtNumber(table); ++n) {
+ if (need == strlen(table[n])
+ && !strncmp(parse, table[n], need)) {
+ result = True;
+ break;
+ }
+ }
+ parse = next;
+ }
+
+ }
+ return result;
+}
+
+/*
+ * Strip the entire action, to avoid matching it.
+ */
+static char *
+stripAction(char *base, char *last)
+{
+ while (last != base) {
+ if (*--last == '\n') {
+ break;
+ }
+ }
+ return last;
+}
+
+static char *
+stripBlanks(char *base, char *last)
+{
+ while (last != base) {
+ int ch = CharOf(last[-1]);
+ if (ch != ' ' && ch != '\t')
+ break;
+ --last;
+ }
+ return last;
+}
/*
* Strip unneeded whitespace from a translations resource, mono-casing and
* returning a malloc'd copy of the result.
*/
static char *
-stripTranslations(const char *s)
+stripTranslations(const char *s, Bool onlyInsert)
{
char *dst = 0;
@@ -1693,16 +1774,17 @@ stripTranslations(const char *s)
*d++ = (char) ch;
state = 0;
} else if (strchr(":!#", ch) != 0) {
- while (d != dst && isspace(CharOf(d[-1])))
- --d;
+ d = stripBlanks(dst, d);
+ if (onlyInsert && (ch == ':') && !keyCanInsert(s)) {
+ d = stripAction(dst, d);
+ }
state = -1;
} else if (state >= 0) {
if (isspace(CharOf(ch))) {
if (state == 0 || strchr("<>~ \t", prv))
continue;
} else if (strchr("<>~", ch)) {
- while (d != dst && isspace(CharOf(d[-1])))
- --d;
+ d = stripBlanks(dst, d);
}
*d++ = x_toupper(ch);
++state;
@@ -1731,7 +1813,7 @@ stripTranslations(const char *s)
* "XTerm*translations", we see only the latter.
*/
static Bool
-TranslationsUseKeyword(Widget w, char **cache, const char *keyword)
+TranslationsUseKeyword(Widget w, char **cache, const char *keyword, Bool onlyInsert)
{
static String data;
static XtResource key_resources[] =
@@ -1743,7 +1825,7 @@ TranslationsUseKeyword(Widget w, char **cache, const char *keyword)
char *copy;
char *test;
- if ((test = stripTranslations(keyword)) != 0) {
+ if ((test = stripTranslations(keyword, onlyInsert)) != 0) {
if (*cache == 0) {
XtGetSubresources(w,
(XtPointer) &data,
@@ -1753,7 +1835,7 @@ TranslationsUseKeyword(Widget w, char **cache, const char *keyword)
XtNumber(key_resources),
NULL,
(Cardinal) 0);
- if (data != 0 && (copy = stripTranslations(data)) != 0) {
+ if (data != 0 && (copy = stripTranslations(data, onlyInsert)) != 0) {
*cache = copy;
}
}
@@ -1794,29 +1876,31 @@ TranslationsUseKeyword(Widget w, char **cache, const char *keyword)
}
static Bool
-xtermHasTranslation(XtermWidget xw, const char *keyword)
+xtermHasTranslation(XtermWidget xw, const char *keyword, Bool onlyInsert)
{
return (TranslationsUseKeyword(SHELL_OF(xw),
&(xw->keyboard.shell_translations),
- keyword)
+ keyword,
+ onlyInsert)
|| TranslationsUseKeyword((Widget) xw,
&(xw->keyboard.xterm_translations),
- keyword));
+ keyword,
+ onlyInsert));
}
#if OPT_EXTRA_PASTE
static void
addTranslation(XtermWidget xw, const char *fromString, const char *toString)
{
- unsigned have = (xw->keyboard.extra_translations
- ? strlen(xw->keyboard.extra_translations)
- : 0);
- unsigned need = (((have != 0) ? (have + 4) : 0)
- + strlen(fromString)
- + strlen(toString)
- + 6);
-
- if (!xtermHasTranslation(xw, fromString)) {
+ size_t have = (xw->keyboard.extra_translations
+ ? strlen(xw->keyboard.extra_translations)
+ : 0);
+ size_t need = (((have != 0) ? (have + 4) : 0)
+ + strlen(fromString)
+ + strlen(toString)
+ + 6);
+
+ if (!xtermHasTranslation(xw, fromString, False)) {
xw->keyboard.extra_translations
= TypeRealloc(char, need, xw->keyboard.extra_translations);
if ((xw->keyboard.extra_translations) != 0) {
@@ -1831,11 +1915,11 @@ addTranslation(XtermWidget xw, const char *fromString, const char *toString)
}
#endif
-#define SaveMask(name) xw->misc.name |= mask;\
- TRACE(("SaveMask(%s) %#lx (%#lx is%s modifier)\n", \
+#define SaveMask(name) xw->misc.name |= (unsigned) mask;\
+ TRACE(("SaveMask(%s) %#x (%#x is%s modifier)\n", \
#name, \
- xw->misc.name, mask, \
- ModifierName(mask)));
+ xw->misc.name, (unsigned) mask, \
+ ModifierName((unsigned) mask)));
/*
* Determine which modifier mask (if any) applies to the Num_Lock keysym.
*
@@ -1938,12 +2022,25 @@ VTInitModifiers(XtermWidget xw)
/* Don't disable any mods if "alwaysUseMods" is true. */
if (!xw->misc.alwaysUseMods) {
+
+ /*
+ * Force TranslationsUseKeyword() to reload.
+ */
+ if (xw->keyboard.shell_translations) {
+ free(xw->keyboard.shell_translations);
+ xw->keyboard.shell_translations = 0;
+ }
+ if (xw->keyboard.xterm_translations) {
+ free(xw->keyboard.xterm_translations);
+ xw->keyboard.xterm_translations = 0;
+ }
+
/*
* If the Alt modifier is used in translations, we would rather not
* use it to modify function-keys when NumLock is active.
*/
if ((xw->misc.alt_mods != 0)
- && xtermHasTranslation(xw, "alt")) {
+ && xtermHasTranslation(xw, "alt", True)) {
TRACE(("ALT is used as a modifier in translations (ignore mask)\n"));
xw->misc.alt_mods = 0;
}
@@ -1953,7 +2050,7 @@ VTInitModifiers(XtermWidget xw)
* use it to modify function-keys.
*/
if ((xw->misc.meta_mods != 0)
- && xtermHasTranslation(xw, "meta")) {
+ && xtermHasTranslation(xw, "meta", True)) {
TRACE(("META is used as a modifier in translations\n"));
xw->misc.meta_mods = 0;
}
diff --git a/app/xterm/linedata.c b/app/xterm/linedata.c
index b86b0606c..d39772b72 100644
--- a/app/xterm/linedata.c
+++ b/app/xterm/linedata.c
@@ -1,8 +1,8 @@
-/* $XTermId: linedata.c,v 1.73 2009/11/28 13:36:02 tom Exp $ */
+/* $XTermId: linedata.c,v 1.78 2010/04/14 23:41:10 tom Exp $ */
/************************************************************
-Copyright 2009 by Thomas E. Dickey
+Copyright 2009,2010 by Thomas E. Dickey
All Rights Reserved
@@ -48,6 +48,7 @@ getLineData(TScreen * screen, int row)
{
LineData *result = 0;
ScrnBuf buffer;
+ int max_row = screen->max_row;
if (row >= 0) {
buffer = screen->visbuf;
@@ -58,10 +59,10 @@ getLineData(TScreen * screen, int row)
#else
buffer = screen->saveBuf_index;
row += screen->savelines;
+ max_row += screen->savelines;
#endif
}
- if (row >= 0) {
- assert(row <= screen->max_row);
+ if (row >= 0 && row <= max_row) {
result = (LineData *) scrnHeadAddr(screen, buffer, (unsigned) row);
if (result != 0) {
#if 1 /* FIXME - these should be done in setupLineData, etc. */
@@ -162,23 +163,23 @@ initLineData(XtermWidget xw)
initLineExtra(screen);
- TRACE(("initLineData %d\n", screen->lineExtra));
- TRACE(("...sizeof(LineData) %d\n", sizeof(LineData)));
+ TRACE(("initLineData %lu\n", (unsigned long) screen->lineExtra));
+ TRACE(("...sizeof(LineData) %lu\n", (unsigned long) sizeof(LineData)));
#if OPT_ISO_COLORS
- TRACE(("...sizeof(CellColor) %d\n", sizeof(CellColor)));
+ TRACE(("...sizeof(CellColor) %lu\n", (unsigned long) sizeof(CellColor)));
#endif
- TRACE(("...sizeof(RowData) %d\n", sizeof(RowData)));
- TRACE(("...offset(lineSize) %d\n", offsetof(LineData, lineSize)));
- TRACE(("...offset(bufHead) %d\n", offsetof(LineData, bufHead)));
+ TRACE(("...sizeof(RowData) %lu\n", (unsigned long) sizeof(RowData)));
+ TRACE(("...offset(lineSize) %lu\n", (unsigned long) offsetof(LineData, lineSize)));
+ TRACE(("...offset(bufHead) %lu\n", (unsigned long) offsetof(LineData, bufHead)));
#if OPT_WIDE_CHARS
- TRACE(("...offset(combSize) %d\n", offsetof(LineData, combSize)));
+ TRACE(("...offset(combSize) %lu\n", (unsigned long) offsetof(LineData, combSize)));
#endif
- TRACE(("...offset(attribs) %d\n", offsetof(LineData, attribs)));
+ TRACE(("...offset(attribs) %lu\n", (unsigned long) offsetof(LineData, attribs)));
#if OPT_ISO_COLORS
- TRACE(("...offset(color) %d\n", offsetof(LineData, color)));
+ TRACE(("...offset(color) %lu\n", (unsigned long) offsetof(LineData, color)));
#endif
- TRACE(("...offset(charData) %d\n", offsetof(LineData, charData)));
- TRACE(("...offset(combData) %d\n", offsetof(LineData, combData)));
+ TRACE(("...offset(charData) %lu\n", (unsigned long) offsetof(LineData, charData)));
+ TRACE(("...offset(combData) %lu\n", (unsigned long) offsetof(LineData, combData)));
}
/*
diff --git a/app/xterm/main.c b/app/xterm/main.c
index 204e4b470..a9f14bc66 100644
--- a/app/xterm/main.c
+++ b/app/xterm/main.c
@@ -1,4 +1,4 @@
-/* $XTermId: main.c,v 1.602 2010/01/20 22:07:23 tom Exp $ */
+/* $XTermId: main.c,v 1.610 2010/04/18 17:09:13 tom Exp $ */
/*
* W A R N I N G
@@ -844,7 +844,7 @@ static XtResource application_resources[] =
Bres("messages", "Messages", messages, True),
Ires("minBufSize", "MinBufSize", minBufSize, 4096),
Ires("maxBufSize", "MaxBufSize", maxBufSize, 32768),
- Sres("menuLocale", "MenuLocale", menuLocale, ""),
+ Sres("menuLocale", "MenuLocale", menuLocale, DEF_MENU_LOCALE),
Sres("keyboardType", "KeyboardType", keyboardType, "unknown"),
#if OPT_SUNPC_KBD
Bres("sunKeyboard", "SunKeyboard", sunKeyboard, False),
@@ -1823,7 +1823,7 @@ main(int argc, char *argv[]ENVP_ARG)
Version();
} else if (abbrev(argv[n], "-help", unique)) {
Help();
- } else if (abbrev(argv[n], "-class", 3)) {
+ } else if (abbrev(argv[n], "-class", (size_t) 3)) {
if ((my_class = argv[++n]) == 0) {
Help();
} else {
@@ -1832,7 +1832,7 @@ main(int argc, char *argv[]ENVP_ARG)
unique = 3;
} else {
#if OPT_COLOR_RES
- if (abbrev(argv[n], "-reverse", 2)
+ if (abbrev(argv[n], "-reverse", (size_t) 2)
|| !strcmp("-rv", argv[n])) {
reversed = True;
} else if (!strcmp("+rv", argv[n])) {
@@ -2913,7 +2913,8 @@ set_owner(char *device, uid_t uid, gid_t gid, mode_t mode)
int why;
TRACE_IDS;
- TRACE(("set_owner(%s, uid=%d, gid=%d, mode=%#o\n", device, uid, gid, mode));
+ TRACE(("set_owner(%s, uid=%d, gid=%d, mode=%#o\n",
+ device, uid, gid, (unsigned) mode));
if (chown(device, uid, gid) < 0) {
why = errno;
@@ -2941,7 +2942,7 @@ set_owner(char *device, uid_t uid, gid_t gid, mode_t mode)
(unsigned long) (sb.st_mode & 0777U),
strerror(why));
TRACE(("...stat uid=%d, gid=%d, mode=%#o\n",
- sb.st_uid, sb.st_gid, sb.st_mode));
+ sb.st_uid, sb.st_gid, (unsigned) sb.st_mode));
}
}
TRACE(("...chmod failed: %s\n", strerror(why)));
@@ -3492,13 +3493,13 @@ spawnXTerm(XtermWidget xw)
*/
if (cp_pipe[1] <= 2) {
if ((i = fcntl(cp_pipe[1], F_DUPFD, 3)) >= 0) {
- (void) close(cp_pipe[1]);
+ IGNORE_RC(close(cp_pipe[1]));
cp_pipe[1] = i;
}
}
if (pc_pipe[0] <= 2) {
if ((i = fcntl(pc_pipe[0], F_DUPFD, 3)) >= 0) {
- (void) close(pc_pipe[0]);
+ IGNORE_RC(close(pc_pipe[0]));
pc_pipe[0] = i;
}
}
@@ -3506,7 +3507,8 @@ spawnXTerm(XtermWidget xw)
/* we don't need the socket, or the pty master anymore */
close(ConnectionNumber(screen->display));
#ifndef __MVS__
- close(screen->respond);
+ if (screen->respond >= 0)
+ close(screen->respond);
#endif /* __MVS__ */
/* Now is the time to set up our process group and
@@ -3514,9 +3516,9 @@ spawnXTerm(XtermWidget xw)
*/
#ifdef USE_SYSV_PGRP
#if defined(CRAY) && (OSMAJORVERSION > 5)
- (void) setsid();
+ IGNORE_RC(setsid());
#else
- (void) setpgrp();
+ IGNORE_RC(setpgrp());
#endif
#endif /* USE_SYSV_PGRP */
@@ -3543,7 +3545,7 @@ spawnXTerm(XtermWidget xw)
}
#endif /* TIOCNOTTY && !glibc >= 2.1 */
#ifdef CSRG_BASED
- (void) revoke(ttydev);
+ IGNORE_RC(revoke(ttydev));
#endif
if ((ttyfd = open(ttydev, O_RDWR)) >= 0) {
#if defined(CRAY) && defined(TCSETCTTY)
@@ -3832,7 +3834,7 @@ spawnXTerm(XtermWidget xw)
if (fd == -1 || ioctl(fd, SRIOCSREDIR, ttyfd) == -1)
fprintf(stderr, "%s: cannot open console: %s\n",
ProgramName, strerror(errno));
- (void) close(fd);
+ IGNORE_RC(close(fd));
#endif
}
#endif /* TIOCCONS */
@@ -3912,20 +3914,20 @@ spawnXTerm(XtermWidget xw)
#if defined(CRAY) && (OSMAJORVERSION >= 6)
close_fd(ttyfd);
- (void) close(0);
+ IGNORE_RC(close(0));
if (open("/dev/tty", O_RDWR)) {
SysError(ERROR_OPDEVTTY);
}
- (void) close(1);
- (void) close(2);
+ IGNORE_RC(close(1));
+ IGNORE_RC(close(2));
dup(0);
dup(0);
#else
/* dup the tty */
for (i = 0; i <= 2; i++)
if (i != ttyfd) {
- (void) close(i);
+ IGNORE_RC(close(i));
IGNORE_RC(dup(ttyfd));
}
#ifndef ATT
@@ -4032,7 +4034,7 @@ spawnXTerm(XtermWidget xw)
TRACE(("getutid: NULL\n"));
else
TRACE(("getutid: pid=%d type=%d user=%s line=%s id=%s\n",
- utret->ut_pid, utret->ut_type, utret->ut_user,
+ (int) utret->ut_pid, utret->ut_type, utret->ut_user,
utret->ut_line, utret->ut_id));
#endif
@@ -4201,13 +4203,13 @@ spawnXTerm(XtermWidget xw)
handshake.error = 0;
strcpy(handshake.buffer, ttydev);
TRACE_HANDSHAKE("writing", &handshake);
- (void) write(cp_pipe[1], (char *) &handshake, sizeof(handshake));
+ IGNORE_RC(write(cp_pipe[1], (char *) &handshake, sizeof(handshake)));
}
#endif /* OPT_PTY_HANDSHAKE */
#endif /* USE_UTEMPTER */
#endif /* HAVE_UTMP */
- (void) setgid(screen->gid);
+ IGNORE_RC(setgid(screen->gid));
TRACE_IDS;
#ifdef HAS_BSD_GROUPS
if (geteuid() == 0 && pw) {
@@ -4423,7 +4425,7 @@ spawnXTerm(XtermWidget xw)
/* Exec failed. */
fprintf(stderr, "%s: Could not exec %s: %s\n", ProgramName,
ptr, strerror(errno));
- (void) sleep(5);
+ IGNORE_RC(sleep(5));
exit(ERROR_EXEC);
}
/* end if in child after fork */
@@ -4461,7 +4463,7 @@ spawnXTerm(XtermWidget xw)
/* The open of the pty failed! Let's get
* another one.
*/
- (void) close(screen->respond);
+ IGNORE_RC(close(screen->respond));
if (get_pty(&screen->respond, XDisplayString(screen->display))) {
/* no more ptys! */
fprintf(stderr,
diff --git a/app/xterm/main.h b/app/xterm/main.h
index fa5688ea9..7aa9c88e6 100644
--- a/app/xterm/main.h
+++ b/app/xterm/main.h
@@ -1,4 +1,4 @@
-/* $XTermId: main.h,v 1.51 2010/01/01 19:53:42 tom Exp $ */
+/* $XTermId: main.h,v 1.52 2010/04/14 09:51:45 tom Exp $ */
/*
* Copyright 2000-2009,2010 by Thomas E. Dickey
@@ -153,6 +153,10 @@
#define DEF_INITIAL_ERASE False
#endif
+#ifndef DEF_MENU_LOCALE
+#define DEF_MENU_LOCALE "C"
+#endif
+
#ifndef DEF_POINTER_MODE
#define DEF_POINTER_MODE pNever
#endif
diff --git a/app/xterm/menu.c b/app/xterm/menu.c
index e4fb665d0..92eec1942 100644
--- a/app/xterm/menu.c
+++ b/app/xterm/menu.c
@@ -1,4 +1,4 @@
-/* $XTermId: menu.c,v 1.261 2010/01/04 22:16:06 tom Exp $ */
+/* $XTermId: menu.c,v 1.262 2010/04/17 15:52:49 tom Exp $ */
/*
*
@@ -444,13 +444,19 @@ static MenuList tek_shell[NUM_POPUP_MENUS];
static String
setMenuLocale(Bool before, String substitute)
{
- String result;
+ String result = setlocale(LC_CTYPE, 0);
- result = setlocale(LC_CTYPE, substitute);
if (before) {
result = x_strdup(result);
- } else {
- result = 0;
+ }
+ (void) setlocale(LC_CTYPE, substitute);
+ TRACE(("setMenuLocale %s:%s\n",
+ (before
+ ? "before"
+ : "after"),
+ NonNull(result)));
+ if (!before) {
+ free((void *) substitute);
}
return result;
}
diff --git a/app/xterm/minstall.sh b/app/xterm/minstall.sh
index 61bf77856..8c9421955 100644
--- a/app/xterm/minstall.sh
+++ b/app/xterm/minstall.sh
@@ -1,12 +1,12 @@
#!/bin/sh
-# $XTermId: minstall.sh,v 1.19 2010/01/20 10:55:42 tom Exp $
+# $XTermId: minstall.sh,v 1.20 2010/03/03 23:44:49 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
# 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
@@ -14,10 +14,10 @@
# 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.
@@ -25,7 +25,7 @@
# 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
@@ -74,9 +74,9 @@ MY_MANSECT=$suffix
# are only a few common choices. Note that they may not necessarily appear
# in the same directories. Prefer utmpx/wtmpx to utmp/wtmp, since that's
# the way the configure script is designed.
-UTMP_NAME=utmp22
+UTMP_NAME=utmp
UTMP_PATH=/etc
-for name in /etc /var/adm /var/log
+for name in /etc /var/adm /var/run /var/log
do
if test -f $name/utmpx ; then
UTMP_NAME=utmpx
@@ -91,7 +91,7 @@ UTMP_PATH=$UTMP_PATH/$UTMP_NAME
WTMP_NAME=wtmp
WTMP_PATH=/etc
-for name in /etc /var/adm /var/log
+for name in /etc /var/adm /var/run /var/log
do
if test -f $name/wtmpx ; then
WTMP_NAME=wtmpx
diff --git a/app/xterm/misc.c b/app/xterm/misc.c
index 20a66e424..3739d8a0b 100644
--- a/app/xterm/misc.c
+++ b/app/xterm/misc.c
@@ -1,10 +1,9 @@
-/* $XTermId: misc.c,v 1.482 2010/01/21 09:34:58 tom Exp $ */
+/* $XTermId: misc.c,v 1.493 2010/04/18 17:51:44 tom Exp $ */
/*
- *
* Copyright 1999-2009,2010 by Thomas E. Dickey
*
- * All Rights Reserved
+ * All Rights Reserved
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -135,7 +134,7 @@ Readlink(const char *filename)
buf = TypeRealloc(char, size, buf);
memset(buf, 0, size);
- n = readlink(filename, buf, size);
+ n = (int) readlink(filename, buf, size);
if (n < 0) {
free(buf);
return NULL;
@@ -184,6 +183,7 @@ selectwindow(TScreen * screen, int flag)
if (screen->cursor_state)
ShowCursor();
}
+ GetScrollLock(screen);
}
static void
@@ -677,8 +677,8 @@ HandleInterpret(Widget w GCC_UNUSED,
if (*param_count == 1) {
char *value = params[0];
int need = (int) strlen(value);
- int used = VTbuffer->next - VTbuffer->buffer;
- int have = VTbuffer->last - VTbuffer->buffer;
+ int used = (int) (VTbuffer->next - VTbuffer->buffer);
+ int have = (int) (VTbuffer->last - VTbuffer->buffer);
if (have - used + need < BUF_SIZE) {
@@ -800,7 +800,7 @@ AtomBell(XtermWidget xw, int which)
for (n = 0; n < XtNumber(table); ++n) {
if (table[n].value == which) {
- result = XInternAtom(XtDisplay(xw), table[n].name, True);
+ result = XInternAtom(XtDisplay(xw), table[n].name, False);
break;
}
}
@@ -1074,8 +1074,8 @@ dabbrev_expand(TScreen * screen)
char *expansion;
Char *copybuffer;
size_t hint_len;
- unsigned del_cnt;
- unsigned buf_cnt;
+ size_t del_cnt;
+ size_t buf_cnt;
int result = 0;
LineData *ld;
@@ -1138,7 +1138,7 @@ dabbrev_expand(TScreen * screen)
memmove(copybuffer + del_cnt,
expansion + hint_len,
strlen(expansion) - hint_len);
- v_write(pty, copybuffer, buf_cnt);
+ v_write(pty, copybuffer, (unsigned) buf_cnt);
/* v_write() just reset our flag */
screen->dabbrev_working = True;
free(copybuffer);
@@ -1760,8 +1760,8 @@ FlushLog(TScreen * screen)
#endif /* VMS */
cp = VTbuffer->next;
if (screen->logstart != 0
- && (i = cp - screen->logstart) > 0) {
- IGNORE_RC(write(screen->logfd, screen->logstart, (unsigned) i));
+ && (i = (int) (cp - screen->logstart)) > 0) {
+ IGNORE_RC(write(screen->logfd, screen->logstart, (size_t) i));
}
screen->logstart = VTbuffer->next;
}
@@ -1941,7 +1941,7 @@ AllocateAnsiColor(XtermWidget xw,
result = 1;
SET_COLOR_RES(res, def.pixel);
TRACE(("AllocateAnsiColor[%d] %s (pixel %#lx)\n",
- (res - screen->Acolors), spec, def.pixel));
+ (int) (res - screen->Acolors), spec, def.pixel));
#if OPT_COLOR_RES
if (!res->mode)
result = 0;
@@ -1965,7 +1965,7 @@ xtermGetColorRes(XtermWidget xw, ColorRes * res)
result = res->value;
} else {
TRACE(("xtermGetColorRes for Acolors[%d]\n",
- res - TScreenOf(xw)->Acolors));
+ (int) (res - TScreenOf(xw)->Acolors)));
if (res >= TScreenOf(xw)->Acolors) {
assert(res - TScreenOf(xw)->Acolors < MAXCOLORS);
@@ -2093,8 +2093,8 @@ ResetAnsiColorRequest(XtermWidget xw, char *buf, int start)
while (!IsEmpty(buf)) {
char *next;
- color = strtol(buf, &next, 10);
- if (next == buf)
+ color = (int) strtol(buf, &next, 10);
+ if ((next == buf) || (color < 0))
break; /* no number at all */
if (next != 0) {
if (strchr(";", *next) == 0)
@@ -2292,7 +2292,7 @@ GetOldColors(XtermWidget xw)
{
int i;
if (pOldColors == NULL) {
- pOldColors = (ScrnColors *) XtMalloc(sizeof(ScrnColors));
+ pOldColors = (ScrnColors *) XtMalloc((Cardinal) sizeof(ScrnColors));
if (pOldColors == NULL) {
fprintf(stderr, "allocation failure in GetOldColors\n");
return (False);
@@ -2475,7 +2475,7 @@ ChangeColorsRequest(XtermWidget xw,
} else if (!pOldColors->names[ndx]
|| (thisName
&& strcmp(thisName, pOldColors->names[ndx]))) {
- AllocateTermColor(xw, &newColors, ndx, thisName);
+ AllocateTermColor(xw, &newColors, ndx, thisName, False);
}
}
}
@@ -2514,7 +2514,7 @@ ResetColorsRequest(XtermWidget xw,
if (thisName != 0
&& pOldColors->names[ndx] != 0
&& strcmp(thisName, pOldColors->names[ndx])) {
- AllocateTermColor(xw, &newColors, ndx, thisName);
+ AllocateTermColor(xw, &newColors, ndx, thisName, False);
if (newColors.which != 0) {
ChangeColors(xw, &newColors);
@@ -2698,7 +2698,7 @@ ChangeFontRequest(XtermWidget xw, char *buf)
/***====================================================================***/
void
-do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final)
+do_osc(XtermWidget xw, Char * oscbuf, size_t len, int final)
{
TScreen *screen = TScreenOf(xw);
int mode;
@@ -2735,7 +2735,8 @@ do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final)
/* FALLTHRU */
case 1:
if (*cp != ';') {
- TRACE(("do_osc did not find semicolon offset %d\n", cp - oscbuf));
+ TRACE(("do_osc did not find semicolon offset %d\n",
+ (int) (cp - oscbuf)));
return;
}
state = 2;
@@ -2754,7 +2755,7 @@ do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final)
default:
TRACE(("do_osc found nonprinting char %02X offset %d\n",
CharOf(*cp),
- cp - oscbuf));
+ (int) (cp - oscbuf)));
return;
}
}
@@ -3173,7 +3174,7 @@ do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen)
Bool okay;
ANSI params;
- TRACE(("do_dcs(%s:%d)\n", (char *) dcsbuf, dcslen));
+ TRACE(("do_dcs(%s:%lu)\n", (char *) dcsbuf, (unsigned long) dcslen));
if (dcslen != strlen(cp))
/* shouldn't have nulls in the string */
@@ -3392,7 +3393,7 @@ ChangeGroup(XtermWidget xw, const char *attribute, char *value)
char *my_attr;
char *name;
- unsigned limit;
+ size_t limit;
Char *c1;
Char *cp;
@@ -3624,11 +3625,12 @@ Bool
AllocateTermColor(XtermWidget xw,
ScrnColors * pNew,
int ndx,
- const char *name)
+ const char *name,
+ Bool always)
{
Bool result = False;
- if (AllowColorOps(xw, ecSetColor)) {
+ if (always || AllowColorOps(xw, ecSetColor)) {
XColor def;
TScreen *screen = TScreenOf(xw);
Colormap cmap = xw->core.colormap;
@@ -4156,7 +4158,7 @@ sortedOptDescs(XrmOptionDescRec * descs, Cardinal res_count)
res_array = TypeCallocN(XrmOptionDescRec, res_count);
for (j = 0; j < res_count; j++)
res_array[j] = descs[j];
- qsort(res_array, res_count, sizeof(*res_array), cmp_resources);
+ qsort(res_array, (size_t) res_count, sizeof(*res_array), cmp_resources);
}
return res_array;
}
@@ -4184,7 +4186,7 @@ sortedOpts(OptionHelp * options, XrmOptionDescRec * descs, Cardinal numDescs)
#endif
if (opt_array == 0) {
- Cardinal opt_count, j;
+ size_t opt_count, j;
#if OPT_TRACE
Cardinal k;
XrmOptionDescRec *res_array = sortedOptDescs(descs, numDescs);
@@ -4345,7 +4347,7 @@ xtermVersion(void)
else {
/* some vendors leave trash in this string */
for (;;) {
- if (!strncmp(vendor, "Version ", 8))
+ if (!strncmp(vendor, "Version ", (size_t) 8))
vendor += 8;
else if (isspace(CharOf(*vendor)))
++vendor;
diff --git a/app/xterm/print.c b/app/xterm/print.c
index 08f883d75..a0dfed216 100644
--- a/app/xterm/print.c
+++ b/app/xterm/print.c
@@ -1,8 +1,8 @@
-/* $XTermId: print.c,v 1.115 2009/12/10 09:44:39 tom Exp $ */
+/* $XTermId: print.c,v 1.116 2010/04/05 00:11:13 tom Exp $ */
/************************************************************
-Copyright 1997-2007,2009 by Thomas E. Dickey
+Copyright 1997-2009,2010 by Thomas E. Dickey
All Rights Reserved
@@ -434,7 +434,7 @@ charToPrinter(XtermWidget xw, unsigned chr)
close(my_pipe[0]); /* won't read from printer */
Printer = fdopen(my_pipe[1], "w");
TRACE(("opened printer from pid %d/%d\n",
- (int) getpid(), Printer_pid));
+ (int) getpid(), (int) Printer_pid));
}
#endif
initialized++;
diff --git a/app/xterm/ptydata.c b/app/xterm/ptydata.c
index d5ff28653..a90e4509c 100644
--- a/app/xterm/ptydata.c
+++ b/app/xterm/ptydata.c
@@ -1,4 +1,4 @@
-/* $XTermId: ptydata.c,v 1.94 2010/01/21 02:08:28 tom Exp $ */
+/* $XTermId: ptydata.c,v 1.96 2010/04/18 17:51:56 tom Exp $ */
/************************************************************
@@ -62,7 +62,7 @@ Bool
decodeUtf8(PtyData * data)
{
int i;
- int length = data->last - data->next;
+ int length = (int) (data->last - data->next);
int utf_count = 0;
unsigned utf_char = 0;
@@ -192,7 +192,7 @@ readPtyData(TScreen * screen, PtySelect * select_mask, PtyData * data)
int save_err;
trimPtyData(screen, data);
- size = read(screen->respond, (char *) data->last, (unsigned) FRG_SIZE);
+ size = (int) read(screen->respond, (char *) data->last, (size_t) FRG_SIZE);
save_err = errno;
#if (defined(i386) && defined(SVR4) && defined(sun)) || defined(__CYGWIN__)
/*
@@ -322,7 +322,8 @@ initPtyData(PtyData ** result)
TRACE(("initPtyData using minBufSize %d, maxBufSize %d\n",
FRG_SIZE, BUF_SIZE));
- data = (PtyData *) XtMalloc(sizeof(*data) + (unsigned) (BUF_SIZE + FRG_SIZE));
+ data = (PtyData *) XtMalloc((Cardinal) (sizeof(*data)
+ + (unsigned) (BUF_SIZE + FRG_SIZE)));
memset(data, 0, sizeof(*data));
data->next = data->buffer;
@@ -359,7 +360,7 @@ trimPtyData(TScreen * screen GCC_UNUSED, PtyData * data)
FlushLog(screen);
if (data->next != data->buffer) {
- int n = (data->last - data->next);
+ int n = (int) (data->last - data->next);
TRACE(("shifting buffer down by %d\n", n));
for (i = 0; i < n; ++i) {
@@ -385,7 +386,7 @@ fillPtyData(TScreen * screen, PtyData * data, char *value, int length)
trimPtyData(screen, data);
VTbuffer->last += length;
- size = VTbuffer->last - VTbuffer->next;
+ size = (int) (VTbuffer->last - VTbuffer->next);
/* shift the unused portion up to make room */
for (n = size; n >= length; --n)
diff --git a/app/xterm/ptyx.h b/app/xterm/ptyx.h
index 83fc52c7c..f3b1e1a4d 100644
--- a/app/xterm/ptyx.h
+++ b/app/xterm/ptyx.h
@@ -1,4 +1,4 @@
-/* $XTermId: ptyx.h,v 1.656 2010/01/04 09:09:29 tom Exp $ */
+/* $XTermId: ptyx.h,v 1.666 2010/04/18 16:50:09 tom Exp $ */
/*
* Copyright 1999-2009,2010 by Thomas E. Dickey
@@ -77,22 +77,22 @@
#define MyStackAlloc(size, stack_cache_array) \
((size) <= sizeof(stack_cache_array) \
? (XtPointer)(stack_cache_array) \
- : (XtPointer)malloc((unsigned)(size)))
+ : (XtPointer)malloc((size_t)(size)))
#define MyStackFree(pointer, stack_cache_array) \
if ((pointer) != ((char *)(stack_cache_array))) free(pointer)
/* adapted from vile (vi-like-emacs) */
-#define TypeCallocN(type,n) (type *)calloc((n), sizeof(type))
-#define TypeCalloc(type) TypeCallocN(type,1)
+#define TypeCallocN(type,n) (type *)calloc((size_t) (n), sizeof(type))
+#define TypeCalloc(type) TypeCallocN(type, 1)
-#define TypeMallocN(type,n) (type *)malloc(sizeof(type) * (n))
-#define TypeMalloc(type) TypeMallocN(type,1)
+#define TypeMallocN(type,n) (type *)malloc(sizeof(type) * (size_t) (n))
+#define TypeMalloc(type) TypeMallocN(type, 1)
#define TypeRealloc(type,n,p) (type *)realloc(p, (n) * sizeof(type))
/* use these to allocate partly-structured data */
-#define CastMallocN(type,n) (type *)malloc(sizeof(type) + (n))
+#define CastMallocN(type,n) (type *)malloc(sizeof(type) + (size_t) (n))
#define CastMalloc(type) CastMallocN(type,0)
#define BumpBuffer(type, buffer, size, want) \
@@ -330,6 +330,8 @@ typedef struct {
*/
#define ANSI_BEL 0x07
#define ANSI_FF 0x0C /* C0, C1 control names */
+#define ANSI_XON 0x11 /* DC1 */
+#define ANSI_XOFF 0x13 /* DC3 */
#define ANSI_NAK 0x15
#define ANSI_CAN 0x18
#define ANSI_ESC 0x1B
@@ -634,6 +636,10 @@ typedef struct {
#define OPT_SUN_FUNC_KEYS 1 /* true if xterm supports Sun-style function keys */
#endif
+#ifndef OPT_SCROLL_LOCK
+#define OPT_SCROLL_LOCK 1 /* true if xterm interprets fontsize-shifting */
+#endif
+
#ifndef OPT_SELECT_REGEX
#define OPT_SELECT_REGEX 0 /* true if xterm supports regular-expression selects */
#endif
@@ -910,12 +916,12 @@ typedef enum {
, ewLAST
} WindowOps;
-#define COLOR_DEFINED(s,w) ((s)->which & (1<<(w)))
+#define COLOR_DEFINED(s,w) ((s)->which & (unsigned) (1<<(w)))
#define COLOR_VALUE(s,w) ((s)->colors[w])
-#define SET_COLOR_VALUE(s,w,v) (((s)->colors[w] = (v)), ((s)->which |= (1<<(w))))
+#define SET_COLOR_VALUE(s,w,v) (((s)->colors[w] = (v)), UIntSet((s)->which, (1<<(w))))
#define COLOR_NAME(s,w) ((s)->names[w])
-#define SET_COLOR_NAME(s,w,v) (((s)->names[w] = (v)), ((s)->which |= (1<<(w))))
+#define SET_COLOR_NAME(s,w,v) (((s)->names[w] = (v)), ((s)->which |= (unsigned) (1<<(w))))
#define UNDEFINE_COLOR(s,w) ((s)->which &= (~((w)<<1)))
@@ -976,8 +982,6 @@ typedef enum {
# define XK_COLORS 0x0003
#endif
-# define XK_TCAPNAME 0x0004
-
#else /* !OPT_ISO_COLORS */
#define TERM_COLOR_FLAGS(xw) 0
@@ -988,6 +992,8 @@ typedef enum {
#endif /* OPT_ISO_COLORS */
+# define XK_TCAPNAME 0x0004
+
#if OPT_AIX_COLORS
#define if_OPT_AIX_COLORS(screen, code) if(screen->colorMode) code
#else
@@ -1806,6 +1812,13 @@ typedef struct {
unsigned restore_height;
#endif
+#if OPT_SCROLL_LOCK
+ Boolean allowScrollLock;/* ScrollLock mode */
+ Boolean allowScrollLock0;/* initial ScrollLock mode */
+ Boolean scroll_lock; /* true to keep buffer in view */
+ Boolean scroll_dirty; /* scrolling makes screen dirty */
+#endif
+
#if OPT_VT52_MODE
int vt52_save_level; /* save-area for DECANM */
Char vt52_save_curgl;
@@ -1983,7 +1996,7 @@ typedef struct _TekScreen {
#if OPT_READLINE
#define SCREEN_FLAG(screenp,f) (1&(screenp)->f)
#define SCREEN_FLAG_set(screenp,f) ((screenp)->f |= 1)
-#define SCREEN_FLAG_unset(screenp,f) ((screenp)->f &= ~1L)
+#define SCREEN_FLAG_unset(screenp,f) ((screenp)->f &= (unsigned) ~1L)
#define SCREEN_FLAG_save(screenp,f) \
((screenp)->f = (((screenp)->f)<<1) | SCREEN_FLAG(screenp,f))
#define SCREEN_FLAG_restore(screenp,f) ((screenp)->f = (((screenp)->f)>>1))
@@ -2170,10 +2183,10 @@ typedef struct _Misc {
#if OPT_NUM_LOCK
Boolean real_NumLock; /* true if we treat NumLock key specially */
Boolean alwaysUseMods; /* true if we always want f-key modifiers */
- unsigned long num_lock; /* modifier for Num_Lock */
- unsigned long alt_mods; /* modifier for Alt_L or Alt_R */
- unsigned long meta_mods; /* modifier for Meta_L or Meta_R */
- unsigned long other_mods; /* conflicting modifiers, e.g., Mode_Switch */
+ unsigned num_lock; /* modifier for Num_Lock */
+ unsigned alt_mods; /* modifier for Alt_L or Alt_R */
+ unsigned meta_mods; /* modifier for Meta_L or Meta_R */
+ unsigned other_mods; /* conflicting modifiers, e.g., Mode_Switch */
#endif
#if OPT_RENDERFONT
char *face_name;
diff --git a/app/xterm/resize.c b/app/xterm/resize.c
index 069c7cbae..bc1cd1f0f 100644
--- a/app/xterm/resize.c
+++ b/app/xterm/resize.c
@@ -1,7 +1,7 @@
-/* $XTermId: resize.c,v 1.109 2009/10/12 00:41:33 tom Exp $ */
+/* $XTermId: resize.c,v 1.111 2010/04/18 16:35:02 tom Exp $ */
/*
- * Copyright 2003-2008,2009 by Thomas E. Dickey
+ * Copyright 2003-2009,2010 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -341,16 +341,16 @@ main(int argc, char **argv ENVP_ARG)
#ifdef USE_ANY_SYSV_TERMIO
ioctl(tty, TCGETA, &tioorig);
tio = tioorig;
- tio.c_iflag &= ~(ICRNL | IUCLC);
- tio.c_lflag &= ~(ICANON | ECHO);
+ UIntClr(tio.c_iflag, (ICRNL | IUCLC));
+ UIntClr(tio.c_lflag, (ICANON | ECHO));
tio.c_cflag |= CS8;
tio.c_cc[VMIN] = 6;
tio.c_cc[VTIME] = 1;
#elif defined(USE_TERMIOS)
tcgetattr(tty, &tioorig);
tio = tioorig;
- tio.c_iflag &= ~ICRNL;
- tio.c_lflag &= ~(ICANON | ECHO);
+ UIntClr(tio.c_iflag, ICRNL);
+ UIntClr(tio.c_lflag, (ICANON | ECHO));
tio.c_cflag |= CS8;
tio.c_cc[VMIN] = 6;
tio.c_cc[VTIME] = 1;
@@ -358,7 +358,7 @@ main(int argc, char **argv ENVP_ARG)
ioctl(tty, TIOCGETP, &sgorig);
sg = sgorig;
sg.sg_flags |= RAW;
- sg.sg_flags &= ~ECHO;
+ UIntClr(sg.sg_flags, ECHO);
#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */
signal(SIGINT, onintr);
signal(SIGQUIT, onintr);
@@ -449,7 +449,7 @@ main(int argc, char **argv ENVP_ARG)
}
i = ptr - termcap + 3;
- strncpy(newtc, termcap, (unsigned) i);
+ strncpy(newtc, termcap, (size_t) i);
sprintf(newtc + i, "%d", cols);
ptr = strchr(ptr, ':');
strcat(newtc, ptr);
@@ -461,7 +461,7 @@ main(int argc, char **argv ENVP_ARG)
}
i = ptr - newtc + 3;
- strncpy(termcap, newtc, (unsigned) i);
+ strncpy(termcap, newtc, (size_t) i);
sprintf(termcap + i, "%d", rows);
ptr = strchr(ptr, ':');
strcat(termcap, ptr);
diff --git a/app/xterm/screen.c b/app/xterm/screen.c
index e24d20ff7..e05d1ee49 100644
--- a/app/xterm/screen.c
+++ b/app/xterm/screen.c
@@ -1,4 +1,4 @@
-/* $XTermId: screen.c,v 1.410 2010/01/20 01:38:46 tom Exp $ */
+/* $XTermId: screen.c,v 1.418 2010/04/28 23:49:28 tom Exp $ */
/*
* Copyright 1999-2009,2010 by Thomas E. Dickey
@@ -79,20 +79,20 @@
#define getMaxCol(screen) ((screen)->max_col)
#define MoveLineData(base, dst, src, len) \
- memmove(scrnHeadAddr(screen, base, dst), \
- scrnHeadAddr(screen, base, src), \
- scrnHeadSize(screen, len))
+ memmove(scrnHeadAddr(screen, base, (unsigned) (dst)), \
+ scrnHeadAddr(screen, base, (unsigned) (src)), \
+ (size_t) scrnHeadSize(screen, (unsigned) (len)))
#define SaveLineData(base, src, len) \
(void) ScrnPointers(screen, len); \
memcpy (screen->save_ptr, \
scrnHeadAddr(screen, base, src), \
- scrnHeadSize(screen, len))
+ (size_t) scrnHeadSize(screen, (unsigned) (len)))
#define RestoreLineData(base, dst, len) \
memcpy (scrnHeadAddr(screen, base, dst), \
screen->save_ptr, \
- scrnHeadSize(screen, len))
+ (size_t) scrnHeadSize(screen, (unsigned) (len)))
#if OPT_SAVE_LINES
#define VisBuf(screen) screen->editBuf_index[screen->whichBuf]
@@ -104,7 +104,7 @@
* ScrnPtr's can point to different types of data.
*/
#define SizeofScrnPtr(name) \
- sizeof(*((LineData *)0)->name)
+ (unsigned) sizeof(*((LineData *)0)->name)
/*
* The pointers in LineData point into a block of text allocated as a single
@@ -116,7 +116,7 @@
#define AlignValue(value) \
if (!IsAligned(value)) \
- value = (value | AlignMask()) + 1
+ value = (value | (unsigned) AlignMask()) + 1
#define SetupScrnPtr(dst,src,type) \
dst = (type *) src; \
@@ -156,7 +156,7 @@ scrnHeadSize(TScreen * screen, unsigned count)
#if OPT_WIDE_CHARS
if (screen->wide_chars) {
- result += screen->lineExtra;
+ result += (unsigned) screen->lineExtra;
}
#endif
result *= count;
@@ -265,7 +265,7 @@ allocScrnHead(TScreen * screen, unsigned nrow)
ScrnPtr *result;
unsigned size = scrnHeadSize(screen, 1);
- result = (ScrnPtr *) calloc(nrow, size);
+ result = (ScrnPtr *) calloc((size_t) nrow, (size_t) size);
if (result == 0)
SysError(ERROR_SCALLOC);
@@ -289,7 +289,7 @@ sizeofScrnRow(TScreen * screen, unsigned ncol)
(void) screen;
- result = (ncol * sizeof(CharData));
+ result = (ncol * (unsigned) sizeof(CharData));
AlignValue(result);
#if OPT_WIDE_CHARS
@@ -320,8 +320,8 @@ allocScrnData(TScreen * screen, unsigned nrow, unsigned ncol)
if ((result = (Char *) calloc(length, sizeof(Char))) == 0)
SysError(ERROR_SCALLOC2);
- TRACE(("allocScrnData %dx%d -> %d -> %p..%p\n",
- nrow, ncol, length, result, result + length - 1));
+ TRACE(("allocScrnData %ux%u -> %lu -> %p..%p\n",
+ nrow, ncol, (unsigned long) length, result, result + length - 1));
return result;
}
@@ -669,12 +669,12 @@ ClearCells(XtermWidget xw, int flags, unsigned len, int row, int col)
ld = getLineData(screen, row);
- flags |= TERM_COLOR_FLAGS(xw);
+ UIntSet(flags, TERM_COLOR_FLAGS(xw));
for (n = 0; n < len; ++n)
ld->charData[(unsigned) col + n] = (CharData) ' ';
- memset(ld->attribs + col, flags, len);
+ memset(ld->attribs + col, flags, (size_t) len);
if_OPT_ISO_COLORS(screen, {
CellColor p = xtermColorPair(xw);
@@ -685,7 +685,7 @@ ClearCells(XtermWidget xw, int flags, unsigned len, int row, int col)
if_OPT_WIDE_CHARS(screen, {
size_t off;
for_each_combData(off, ld) {
- memset(ld->combData[off] + col, 0, len * sizeof(CharData));
+ memset(ld->combData[off] + col, 0, (size_t) len * sizeof(CharData));
}
});
}
@@ -739,7 +739,7 @@ void
ScrnWriteText(XtermWidget xw,
IChar * str,
unsigned flags,
- CellColor cur_fg_bg,
+ unsigned cur_fg_bg,
unsigned length)
{
TScreen *screen = TScreenOf(xw);
@@ -841,7 +841,7 @@ ScrnWriteText(XtermWidget xw,
flags &= ATTRIBUTES;
flags |= CHARDRAWN;
- memset(attrs, (Char) flags, real_width);
+ memset(attrs, (Char) flags, (size_t) real_width);
if_OPT_WIDE_CHARS(screen, {
size_t off;
@@ -854,7 +854,7 @@ ScrnWriteText(XtermWidget xw,
if_OPT_ISO_COLORS(screen, {
unsigned j;
for (j = 0; j < real_width; ++j)
- fb[j] = cur_fg_bg;
+ fb[j] = (CellColor) cur_fg_bg;
});
if_OPT_WIDE_CHARS(screen, {
@@ -906,7 +906,7 @@ ScrnClearLines(XtermWidget xw, ScrnBuf sb, int where, unsigned n, unsigned size)
memset(work->charData, 0, size * sizeof(CharData));
if (TERM_COLOR_FLAGS(xw)) {
- memset(work->attribs, (int) flags, size);
+ memset(work->attribs, (int) flags, (size_t) size);
#if OPT_ISO_COLORS
{
CellColor p = xtermColorPair(xw);
@@ -916,7 +916,7 @@ ScrnClearLines(XtermWidget xw, ScrnBuf sb, int where, unsigned n, unsigned size)
}
#endif
} else {
- memset(work->attribs, 0, size);
+ memset(work->attribs, 0, (size_t) size);
#if OPT_ISO_COLORS
memset(work->color, 0, size * sizeof(work->color[0]));
#endif
@@ -991,7 +991,7 @@ ScrnAllocBuf(XtermWidget xw)
size_t
ScrnPointers(TScreen * screen, size_t len)
{
- size_t result = scrnHeadSize(screen, len);
+ size_t result = scrnHeadSize(screen, (unsigned) len);
if (result > screen->save_len) {
if (screen->save_len)
@@ -1273,15 +1273,14 @@ ScrnRefresh(XtermWidget xw,
int row;
int maxrow = toprow + nrows - 1;
int scrollamt = screen->scroll_amt;
- int max = screen->max_row;
unsigned gc_changes = 0;
#ifdef __CYGWIN__
static char first_time = 1;
#endif
static int recurse = 0;
- TRACE(("ScrnRefresh (%d,%d) - (%d,%d)%s {{\n",
- toprow, leftcol,
+ TRACE(("ScrnRefresh top %d (%d,%d) - (%d,%d)%s {{\n",
+ screen->topline, toprow, leftcol,
nrows, ncols,
force ? " force" : ""));
@@ -1325,12 +1324,14 @@ ScrnRefresh(XtermWidget xw,
else
lastind = row - scrollamt;
- TRACE2(("ScrnRefresh row=%d lastind=%d/%d\n", row, lastind, max));
- if (lastind < 0 || lastind > max)
- continue;
+ TRACE2(("ScrnRefresh row=%d lastind=%d ->%d\n",
+ row, lastind, ROW2INX(screen, lastind)));
- if ((ld = getLineData(screen, ROW2INX(screen, lastind))) == 0)
- break;
+ if ((ld = getLineData(screen, ROW2INX(screen, lastind))) == 0
+ || ld->charData == 0
+ || ld->attribs == 0) {
+ continue;
+ }
if (maxcol >= (int) ld->lineSize) {
maxcol = ld->lineSize - 1;
hi_col = maxcol;
@@ -1338,6 +1339,8 @@ 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
@@ -2011,7 +2014,7 @@ ScreenResize(XtermWidget xw,
/* adjust scrolling region */
set_tb_margins(screen, 0, screen->max_row);
- *flags &= ~ORIGIN;
+ UIntClr(*flags, ORIGIN);
if (screen->cur_row > screen->max_row)
set_cur_row(screen, screen->max_row);
@@ -2220,7 +2223,7 @@ ScrnFillRectangle(XtermWidget xw,
unsigned temp = ld->attribs[col];
if (!keepColors) {
- temp &= ~(FG_COLOR | BG_COLOR);
+ UIntClr(temp, (FG_COLOR | BG_COLOR));
}
temp = attrs | (temp & (FG_COLOR | BG_COLOR | PROTECTED));
temp |= CHARDRAWN;
@@ -2408,7 +2411,7 @@ ScrnMarkRectangle(XtermWidget xw,
} else {
switch (params[n]) {
case 0:
- flags &= ~SGR_MASK;
+ UIntClr(flags, SGR_MASK);
break;
case 1:
flags |= BOLD;
@@ -2426,19 +2429,19 @@ ScrnMarkRectangle(XtermWidget xw,
flags |= INVISIBLE;
break;
case 22:
- flags &= ~BOLD;
+ UIntClr(flags, BOLD);
break;
case 24:
- flags &= ~UNDERLINE;
+ UIntClr(flags, UNDERLINE);
break;
case 25:
- flags &= ~BLINK;
+ UIntClr(flags, BLINK);
break;
case 27:
- flags &= ~INVERSE;
+ UIntClr(flags, INVERSE);
break;
case 28:
- flags &= ~INVISIBLE;
+ UIntClr(flags, INVISIBLE);
break;
}
}
diff --git a/app/xterm/scrollback.c b/app/xterm/scrollback.c
index ff207bb5b..a28ec7e16 100644
--- a/app/xterm/scrollback.c
+++ b/app/xterm/scrollback.c
@@ -1,8 +1,8 @@
-/* $XTermId: scrollback.c,v 1.12 2009/10/12 00:06:18 tom Exp $ */
+/* $XTermId: scrollback.c,v 1.14 2010/04/28 21:47:09 tom Exp $ */
/************************************************************
-Copyright 2009 by Thomas E. Dickey
+Copyright 2009,2010 by Thomas E. Dickey
All Rights Reserved
@@ -34,8 +34,9 @@ authorization.
#include <xterm.h>
+#define REAL_ROW(screen, row) ((row) + 1 + (screen)->saved_fifo)
#define ROW2FIFO(screen, row) \
- (unsigned) (((row) + 1 + (screen)->saved_fifo) % (screen)->savelines)
+ (unsigned) (REAL_ROW(screen, row) % (screen)->savelines)
/*
* Given a row-number, find the corresponding data for the line in the VT100
@@ -45,11 +46,18 @@ authorization.
LineData *
getScrollback(TScreen * screen, int row)
{
- unsigned which = ROW2FIFO(screen, row);
- ScrnBuf where = scrnHeadAddr(screen, screen->saveBuf_index, which);
+ LineData *result = 0;
- TRACE(("getScrollback %d -> %d -> %p\n", row, which, (void *) where));
- return (LineData *) where;
+ if (screen->saved_fifo > 0 && REAL_ROW(screen, row) >= 0) {
+ unsigned which = ROW2FIFO(screen, row);
+ ScrnBuf where = scrnHeadAddr(screen, screen->saveBuf_index, which);
+ result = (LineData *) where;
+ }
+
+ TRACE(("getScrollback %d -> %d -> %p\n",
+ row, ROW2FIFO(screen, row),
+ (void *) result));
+ return result;
}
/*
diff --git a/app/xterm/scrollbar.c b/app/xterm/scrollbar.c
index fb79bd961..39a083b7c 100644
--- a/app/xterm/scrollbar.c
+++ b/app/xterm/scrollbar.c
@@ -1,7 +1,7 @@
-/* $XTermId: scrollbar.c,v 1.145 2009/10/12 21:56:35 tom Exp $ */
+/* $XTermId: scrollbar.c,v 1.169 2010/04/21 00:19:04 tom Exp $ */
/*
- * Copyright 2000-2008,2009 by Thomas E. Dickey
+ * Copyright 2000-2009,2010 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -66,6 +66,13 @@
#include <X11/XawPlus/Scrollbar.h>
#endif
+#if defined(HAVE_XKBQUERYEXTENSION) && defined(HAVE_X11_XKBLIB_H) && defined(HAVE_X11_EXTENSIONS_XKB_H)
+#include <X11/extensions/XKB.h>
+#include <X11/XKBlib.h>
+#else
+#undef HAVE_XKBQUERYEXTENSION
+#endif
+
#include <data.h>
#include <error.h>
#include <menu.h>
@@ -331,52 +338,62 @@ ResizeScrollBar(XtermWidget xw)
}
void
-WindowScroll(XtermWidget xw, int top)
+WindowScroll(XtermWidget xw, int top, Bool always GCC_UNUSED)
{
TScreen *screen = TScreenOf(xw);
int i, lines;
int scrolltop, scrollheight, refreshtop;
- if (top < -screen->savedlines)
- top = -screen->savedlines;
- else if (top > 0)
- top = 0;
- if ((i = screen->topline - top) == 0) {
- ScrollBarDrawThumb(screen->scrollWidget);
- return;
- }
+#if OPT_SCROLL_LOCK
+ if (screen->allowScrollLock && (screen->scroll_lock && !always)) {
+ if (screen->scroll_dirty) {
+ screen->scroll_dirty = False;
+ ScrnRefresh(xw, 0, 0, MaxRows(screen), MaxCols(screen), False);
+ }
+ } else
+#endif
+ {
+ if (top < -screen->savedlines) {
+ top = -screen->savedlines;
+ } else if (top > 0) {
+ top = 0;
+ }
- if (screen->cursor_state)
- HideCursor();
- lines = i > 0 ? i : -i;
- if (lines > MaxRows(screen))
- lines = MaxRows(screen);
- scrollheight = screen->max_row - lines + 1;
- if (i > 0)
- refreshtop = scrolltop = 0;
- else {
- scrolltop = lines;
- refreshtop = scrollheight;
- }
- scrolling_copy_area(xw, scrolltop, scrollheight, -i);
- screen->topline = top;
+ if ((i = screen->topline - top) != 0) {
+
+ if (screen->cursor_state)
+ HideCursor();
+ lines = i > 0 ? i : -i;
+ if (lines > MaxRows(screen))
+ lines = MaxRows(screen);
+ scrollheight = screen->max_row - lines + 1;
+ if (i > 0)
+ refreshtop = scrolltop = 0;
+ else {
+ scrolltop = lines;
+ refreshtop = scrollheight;
+ }
+ scrolling_copy_area(xw, scrolltop, scrollheight, -i);
+ screen->topline = top;
- ScrollSelection(screen, i, True);
+ ScrollSelection(screen, i, True);
- XClearArea(
- screen->display,
- VWindow(screen),
- OriginX(screen),
- OriginY(screen) + refreshtop * FontHeight(screen),
- (unsigned) Width(screen),
- (unsigned) (lines * FontHeight(screen)),
- False);
- ScrnRefresh(xw, refreshtop, 0, lines, MaxCols(screen), False);
+ XClearArea(
+ screen->display,
+ VWindow(screen),
+ OriginX(screen),
+ OriginY(screen) + refreshtop * FontHeight(screen),
+ (unsigned) Width(screen),
+ (unsigned) (lines * FontHeight(screen)),
+ False);
+ ScrnRefresh(xw, refreshtop, 0, lines, MaxCols(screen), False);
- ScrollBarDrawThumb(screen->scrollWidget);
#if OPT_BLINK_CURS || OPT_BLINK_TEXT
- RestartBlinking(screen);
+ RestartBlinking(screen);
#endif
+ }
+ }
+ ScrollBarDrawThumb(screen->scrollWidget);
}
#ifdef SCROLLBAR_RIGHT
@@ -521,7 +538,7 @@ ScrollTextTo(
*/
thumbTop = (int) (*topPercent * (screen->savedlines + MaxRows(screen)));
newTopLine = thumbTop - screen->savedlines;
- WindowScroll(xw, newTopLine);
+ WindowScroll(xw, newTopLine, True);
}
}
@@ -540,7 +557,7 @@ ScrollTextUpDownBy(
TScreen *screen = TScreenOf(xw);
int rowOnScreen, newTopLine;
- rowOnScreen = pixels / FontHeight(screen);
+ rowOnScreen = (int) (pixels / FontHeight(screen));
if (rowOnScreen == 0) {
if (pixels < 0)
rowOnScreen = -1;
@@ -548,7 +565,7 @@ ScrollTextUpDownBy(
rowOnScreen = 1;
}
newTopLine = ROW2INX(screen, rowOnScreen);
- WindowScroll(xw, newTopLine);
+ WindowScroll(xw, newTopLine, True);
}
}
@@ -673,3 +690,232 @@ HandleScrollBack(
ScrollTextUpDownBy(xw, (XtPointer) 0, (XtPointer) amount);
}
}
+
+#if OPT_SCROLL_LOCK
+#define SCROLL_LOCK_LED 3
+
+#ifdef HAVE_XKBQUERYEXTENSION
+/*
+ * Check for Xkb on client and server.
+ */
+static int
+have_xkb(Display * dpy)
+{
+ static int initialized = -1;
+
+ if (initialized < 0) {
+ int xkbmajor = XkbMajorVersion;
+ int xkbminor = XkbMinorVersion;
+ int xkbopcode, xkbevent, xkberror;
+
+ initialized = 0;
+ if (XkbLibraryVersion(&xkbmajor, &xkbminor)
+ && XkbQueryExtension(dpy,
+ &xkbopcode,
+ &xkbevent,
+ &xkberror,
+ &xkbmajor,
+ &xkbminor)) {
+ TRACE(("we have Xkb\n"));
+ initialized = 1;
+#if OPT_TRACE
+ {
+ XkbDescPtr xkb;
+ unsigned int mask;
+ int n;
+ char *modStr;
+
+ xkb = XkbGetKeyboard(dpy, XkbAllComponentsMask, XkbUseCoreKbd);
+ if (xkb != NULL) {
+
+ TRACE(("XkbGetKeyboard ok\n"));
+ for (n = 0; n < XkbNumVirtualMods; ++n) {
+ if (xkb->names->vmods[n] != 0) {
+ modStr = XGetAtomName(xkb->dpy,
+ xkb->names->vmods[n]);
+ if (modStr != 0) {
+ XkbVirtualModsToReal(xkb, 1 << n, &mask);
+ TRACE((" name[%d] %s (%#x)\n", n, modStr, mask));
+ }
+ }
+ }
+ XkbFreeKeyboard(xkb, 0, True);
+ }
+ }
+#endif
+ }
+ }
+ return initialized;
+}
+
+static Boolean
+getXkbLED(Display * dpy, const char *name, Boolean * result)
+{
+ Atom my_atom;
+ Boolean success = False;
+ Bool state;
+
+ if (have_xkb(dpy)) {
+ my_atom = XInternAtom(dpy, name, True);
+ if ((my_atom != None) &&
+ XkbGetNamedIndicator(dpy, my_atom, NULL, &state, NULL, NULL)) {
+ *result = (Boolean) state;
+ success = True;
+ }
+ }
+
+ return success;
+}
+
+/*
+ * Use Xkb if we have it (still unreliable, but slightly better than hardcoded).
+ */
+static Boolean
+showXkbLED(Display * dpy, const char *name, Bool enable)
+{
+ Atom my_atom;
+ Boolean result = False;
+
+ if (have_xkb(dpy)) {
+ my_atom = XInternAtom(dpy, name, True);
+ if ((my_atom != None) &&
+ XkbGetNamedIndicator(dpy, my_atom, NULL, NULL, NULL, NULL) &&
+ XkbSetNamedIndicator(dpy, my_atom, True, enable, False, NULL)) {
+ result = True;
+ }
+ }
+
+ return result;
+}
+#endif
+
+static const char *led_table[] =
+{
+ "Num Lock",
+ "Caps Lock",
+ "Scroll Lock"
+};
+
+static Boolean
+xtermGetLED(TScreen * screen, Cardinal led_number)
+{
+ Display *dpy = screen->display;
+ Boolean result = False;
+
+#ifdef HAVE_XKBQUERYEXTENSION
+ if (!getXkbLED(dpy, led_table[led_number - 1], &result))
+#endif
+ {
+ XKeyboardState state;
+ unsigned long my_bit = (unsigned long) (1 << (led_number - 1));
+
+ XGetKeyboardControl(dpy, &state);
+
+ result = (Boolean) ((state.led_mask & my_bit) != 0);
+ }
+
+ TRACE(("xtermGetLED %d:%s\n", led_number, BtoS(result)));
+ return result;
+}
+
+/*
+ * Display the given LED, preferably independent of keyboard state.
+ */
+void
+xtermShowLED(TScreen * screen, Cardinal led_number, Bool enable)
+{
+ TRACE(("xtermShowLED %d:%s\n", led_number, BtoS(enable)));
+ if ((led_number >= 1) && (led_number <= XtNumber(led_table))) {
+ Display *dpy = screen->display;
+
+#ifdef HAVE_XKBQUERYEXTENSION
+ if (!showXkbLED(dpy, led_table[led_number - 1], enable))
+#endif
+ {
+ XKeyboardState state;
+ XKeyboardControl values;
+ unsigned long use_mask;
+ unsigned long my_bit = (unsigned long) (1 << (led_number - 1));
+
+ XGetKeyboardControl(dpy, &state);
+ use_mask = state.led_mask;
+ if (enable) {
+ use_mask |= my_bit;
+ } else {
+ use_mask &= ~my_bit;
+ }
+
+ if (state.led_mask != use_mask) {
+ values.led = (int) led_number;
+ values.led_mode = enable;
+ XChangeKeyboardControl(dpy, KBLed | KBLedMode, &values);
+ }
+ }
+ }
+}
+
+void
+xtermClearLEDs(TScreen * screen)
+{
+ Display *dpy = screen->display;
+ XKeyboardControl values;
+
+ TRACE(("xtermClearLEDs\n"));
+ memset(&values, 0, sizeof(values));
+ XChangeKeyboardControl(dpy, KBLedMode, &values);
+}
+
+void
+ShowScrollLock(TScreen * screen, Bool enable)
+{
+ xtermShowLED(screen, SCROLL_LOCK_LED, enable);
+}
+
+void
+GetScrollLock(TScreen * screen)
+{
+ if (screen->allowScrollLock)
+ screen->scroll_lock = xtermGetLED(screen, SCROLL_LOCK_LED);
+}
+
+void
+SetScrollLock(TScreen * screen, Bool enable)
+{
+ if (screen->allowScrollLock) {
+ if (screen->scroll_lock != enable) {
+ screen->scroll_lock = (Boolean) enable;
+ ShowScrollLock(screen, enable);
+ }
+ }
+}
+
+void
+HandleScrollLock(Widget w,
+ XEvent * event GCC_UNUSED,
+ String * params,
+ Cardinal *param_count)
+{
+ XtermWidget xw;
+
+ if ((xw = getXtermWidget(w)) != 0) {
+ TScreen *screen = TScreenOf(xw);
+
+ if (screen->allowScrollLock) {
+ /*
+ * The default action (used with KeyRelease event) is to cycle the
+ * state on/off.
+ */
+ if (*param_count == 0) {
+ SetScrollLock(screen, !screen->scroll_lock);
+ TRACE(("HandleScrollLock ->%d\n",
+ screen->scroll_lock));
+ } else {
+ SetScrollLock(screen, atoi(params[0]));
+ TRACE(("HandleScrollLock(%s) ->%d\n",
+ params[0],
+ screen->scroll_lock));
+ }
+ }
+ }
+}
+#endif
diff --git a/app/xterm/sinstall.sh b/app/xterm/sinstall.sh
index 50a031236..fa85ec71d 100644
--- a/app/xterm/sinstall.sh
+++ b/app/xterm/sinstall.sh
@@ -1,9 +1,9 @@
#!/bin/sh
-# $XTermId: sinstall.sh,v 1.17 2008/03/02 23:35:02 tom Exp $
+# $XTermId: sinstall.sh,v 1.18 2010/03/06 16:19:13 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 1999-2006,2008 by Thomas E. Dickey
+# Copyright 1999-2008,2010 by Thomas E. Dickey
#
# All Rights Reserved
#
@@ -159,7 +159,7 @@ elif test -f "$REF_PROG" ; then
PROG_USR=
;;
esac
- PROG_MODE=`echo ".$cf_mode" | sed -e 's/^..//' -e 's/rw./7/g' -e 's/r-./5/g' -e 's/---/0/g' -e 's/--[sxt]/1/g' -e 's/+//g'`
+ PROG_MODE=`echo ".$cf_mode" | sed -e 's/^..//' -e 's/rw./7/g' -e 's/r-./5/g' -e 's/---/0/g' -e 's/--[sxt]/1/g' -e 's/[^0-7]//g'`
fi
# passed-in options override the reference
diff --git a/app/xterm/tabs.c b/app/xterm/tabs.c
index 52cec209d..70d3e1eba 100644
--- a/app/xterm/tabs.c
+++ b/app/xterm/tabs.c
@@ -1,7 +1,7 @@
-/* $XTermId: tabs.c,v 1.37 2009/11/28 14:11:06 tom Exp $ */
+/* $XTermId: tabs.c,v 1.38 2010/04/17 17:11:43 tom Exp $ */
/*
- * Copyright 2000-2008,2009 by Thomas E. Dickey
+ * Copyright 2000-2009,2010 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -59,9 +59,9 @@
#define TAB_INDEX(n) ((n) >> TAB_BITS_SHIFT)
#define TAB_MASK(n) (1 << ((n) & (TAB_BITS_WIDTH-1)))
-#define SET_TAB(tabs,n) tabs[TAB_INDEX(n)] |= TAB_MASK(n)
-#define CLR_TAB(tabs,n) tabs[TAB_INDEX(n)] &= ~TAB_MASK(n)
-#define TST_TAB(tabs,n) tabs[TAB_INDEX(n)] & TAB_MASK(n)
+#define SET_TAB(tabs,n) UIntSet(tabs[TAB_INDEX(n)], TAB_MASK(n))
+#define CLR_TAB(tabs,n) UIntClr(tabs[TAB_INDEX(n)], TAB_MASK(n))
+#define TST_TAB(tabs,n) (tabs[TAB_INDEX(n)] & (unsigned) TAB_MASK(n))
/*
* places tabstops at only every 8 columns
diff --git a/app/xterm/testxmc.c b/app/xterm/testxmc.c
index dacada25d..44e4919a7 100644
--- a/app/xterm/testxmc.c
+++ b/app/xterm/testxmc.c
@@ -1,8 +1,8 @@
-/* $XTermId: testxmc.c,v 1.46 2009/11/28 14:15:24 tom Exp $ */
+/* $XTermId: testxmc.c,v 1.47 2010/04/17 17:11:33 tom Exp $ */
/************************************************************
-Copyright 1997-2006,2009 by Thomas E. Dickey
+Copyright 1997-2009,2010 by Thomas E. Dickey
All Rights Reserved
@@ -88,8 +88,8 @@ authorization.
#include <xterm.h>
#include <data.h>
-#define MARK_ON(a) (my_attrs & a) != 0 && (xw->flags & (whichone = CharOf(a))) == 0
-#define MARK_OFF(a) (my_attrs & a) != 0 && (xw->flags & (whichone = CharOf(a))) != 0
+#define MARK_ON(a) (Bool) ((my_attrs & a) != 0 && (xw->flags & (whichone = CharOf(a))) == 0)
+#define MARK_OFF(a) (Bool) ((my_attrs & a) != 0 && (xw->flags & (whichone = CharOf(a))) != 0)
void
Mark_XMC(XtermWidget xw, int param)
@@ -98,8 +98,8 @@ Mark_XMC(XtermWidget xw, int param)
TScreen *screen = TScreenOf(xw);
Bool found = False;
- Char my_attrs = CharOf(screen->xmc_attributes & XMC_FLAGS);
- Char whichone = 0;
+ unsigned my_attrs = CharOf(screen->xmc_attributes & XMC_FLAGS);
+ unsigned whichone = 0;
if (glitch == 0) {
unsigned len = screen->xmc_glitch;
diff --git a/app/xterm/trace.c b/app/xterm/trace.c
index d01667c68..bd4a0e26c 100644
--- a/app/xterm/trace.c
+++ b/app/xterm/trace.c
@@ -1,8 +1,8 @@
-/* $XTermId: trace.c,v 1.110 2009/12/10 09:36:28 tom Exp $ */
+/* $XTermId: trace.c,v 1.112 2010/04/15 21:45:37 tom Exp $ */
/*
*
- * Copyright 1997-2008,2009 by Thomas E. Dickey
+ * Copyright 1997-2009,2010 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -568,7 +568,7 @@ TraceTranslations(const char *name, Widget w)
XtTranslations xlations;
Widget xcelerat;
- TRACE(("TraceTranslations for %s (widget %#lx)\n", name, (long) w));
+ TRACE(("TraceTranslations for %s (widget %#lx) {{\n", name, (long) w));
if (w) {
XtVaGetValues(w,
XtNtranslations, &xlations,
@@ -583,6 +583,7 @@ TraceTranslations(const char *name, Widget w)
} else {
TRACE(("none (widget is null)\n"));
}
+ TRACE(("}}\n"));
XSetErrorHandler(save);
}
diff --git a/app/xterm/trace.h b/app/xterm/trace.h
index 40ffdd520..fc9176a65 100644
--- a/app/xterm/trace.h
+++ b/app/xterm/trace.h
@@ -1,8 +1,8 @@
-/* $XTermId: trace.h,v 1.51 2009/11/27 18:31:16 tom Exp $ */
+/* $XTermId: trace.h,v 1.52 2010/04/05 00:11:01 tom Exp $ */
/*
*
- * Copyright 1997-2008,2009 by Thomas E. Dickey
+ * Copyright 1997-2009,2010 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -102,7 +102,9 @@ extern void TraceXtermResources(void);
extern int TraceResizeRequest(const char * /* fn */, int /* ln */, Widget /* w */, Dimension /* reqwide */, Dimension /* reqhigh */, Dimension * /* gotwide */, Dimension * /* gothigh */);
#undef REQ_RESIZE
#define REQ_RESIZE(w, reqwide, reqhigh, gotwide, gothigh) \
- TraceResizeRequest(__FILE__, __LINE__, w, reqwide, reqhigh, gotwide, gothigh)
+ TraceResizeRequest(__FILE__, __LINE__, w, \
+ (Dimension) (reqwide), (Dimension) (reqhigh), \
+ (gotwide), (gothigh))
#else
diff --git a/app/xterm/util.c b/app/xterm/util.c
index 2a05264f4..492f91f2e 100644
--- a/app/xterm/util.c
+++ b/app/xterm/util.c
@@ -1,4 +1,4 @@
-/* $XTermId: util.c,v 1.523 2010/01/03 23:56:24 tom Exp $ */
+/* $XTermId: util.c,v 1.534 2010/04/18 17:06:44 tom Exp $ */
/*
* Copyright 1999-2009,2010 by Thomas E. Dickey
@@ -90,6 +90,7 @@ static void vertical_copy_area(XtermWidget xw,
int amount);
#if OPT_WIDE_CHARS
+unsigned first_widechar;
int (*my_wcwidth) (wchar_t);
#endif
@@ -459,82 +460,98 @@ xtermScroll(XtermWidget xw, int amount)
if (amount > i)
amount = i;
- if (ScrnHaveSelection(screen))
- adjustHiliteOnFwdScroll(xw, amount, scroll_all_lines);
-
- if (screen->jumpscroll) {
- if (screen->scroll_amt > 0) {
- if (!screen->fastscroll) {
- if (screen->refresh_amt + amount > i)
- FlushScroll(xw);
- }
- screen->scroll_amt += amount;
- screen->refresh_amt += amount;
- } else {
- if (!screen->fastscroll) {
- if (screen->scroll_amt < 0)
- FlushScroll(xw);
- }
- screen->scroll_amt = amount;
- screen->refresh_amt = amount;
- }
+#if OPT_SCROLL_LOCK
+ if (screen->allowScrollLock && screen->scroll_lock) {
refreshheight = 0;
- } else {
- ScrollSelection(screen, -(amount), False);
- if (amount == i) {
- ClearScreen(xw);
- screen->cursor_busy -= 1;
- return;
+ screen->scroll_amt = 0;
+ screen->refresh_amt = 0;
+ if (--(screen->topline) < -screen->savelines) {
+ screen->topline = -screen->savelines;
+ screen->scroll_dirty = True;
}
-
- shift = INX2ROW(screen, 0);
- bot = screen->max_row - shift;
- scrollheight = i - amount;
- refreshheight = amount;
-
- if ((refreshtop = screen->bot_marg - refreshheight + 1 + shift) >
- (i = screen->max_row - refreshheight + 1))
- refreshtop = i;
-
- if (scroll_all_lines) {
- scrolltop = 0;
- if ((scrollheight += shift) > i)
- scrollheight = i;
- if ((i = screen->savedlines) < screen->savelines) {
- if ((i += amount) > screen->savelines)
- i = screen->savelines;
- screen->savedlines = i;
- ScrollBarDrawThumb(screen->scrollWidget);
+ if (++(screen->savedlines) > screen->savelines) {
+ screen->savedlines = screen->savelines;
+ }
+ } else
+#endif
+ {
+ if (ScrnHaveSelection(screen))
+ adjustHiliteOnFwdScroll(xw, amount, scroll_all_lines);
+
+ if (screen->jumpscroll) {
+ if (screen->scroll_amt > 0) {
+ if (!screen->fastscroll) {
+ if (screen->refresh_amt + amount > i)
+ FlushScroll(xw);
+ }
+ screen->scroll_amt += amount;
+ screen->refresh_amt += amount;
+ } else {
+ if (!screen->fastscroll) {
+ if (screen->scroll_amt < 0)
+ FlushScroll(xw);
+ }
+ screen->scroll_amt = amount;
+ screen->refresh_amt = amount;
}
+ refreshheight = 0;
} else {
- scrolltop = screen->top_marg + shift;
- if ((i = screen->bot_marg - bot) > 0) {
- scrollheight -= i;
- if ((i = screen->top_marg + amount - 1 - bot) >= 0) {
- refreshtop += i;
- refreshheight -= i;
+ ScrollSelection(screen, -(amount), False);
+ if (amount == i) {
+ ClearScreen(xw);
+ screen->cursor_busy -= 1;
+ return;
+ }
+
+ shift = INX2ROW(screen, 0);
+ bot = screen->max_row - shift;
+ scrollheight = i - amount;
+ refreshheight = amount;
+
+ if ((refreshtop = screen->bot_marg - refreshheight + 1 + shift) >
+ (i = screen->max_row - refreshheight + 1))
+ refreshtop = i;
+
+ if (scroll_all_lines) {
+ scrolltop = 0;
+ if ((scrollheight += shift) > i)
+ scrollheight = i;
+ if ((i = screen->savedlines) < screen->savelines) {
+ if ((i += amount) > screen->savelines)
+ i = screen->savelines;
+ screen->savedlines = i;
+ ScrollBarDrawThumb(screen->scrollWidget);
+ }
+ } else {
+ scrolltop = screen->top_marg + shift;
+ if ((i = screen->bot_marg - bot) > 0) {
+ scrollheight -= i;
+ if ((i = screen->top_marg + amount - 1 - bot) >= 0) {
+ refreshtop += i;
+ refreshheight -= i;
+ }
}
}
- }
- if (screen->multiscroll && amount == 1 &&
- screen->topline == 0 && screen->top_marg == 0 &&
- screen->bot_marg == screen->max_row) {
- if (screen->incopy < 0 && screen->scrolls == 0)
- CopyWait(xw);
- screen->scrolls++;
- }
+ if (screen->multiscroll && amount == 1 &&
+ screen->topline == 0 && screen->top_marg == 0 &&
+ screen->bot_marg == screen->max_row) {
+ if (screen->incopy < 0 && screen->scrolls == 0)
+ CopyWait(xw);
+ screen->scrolls++;
+ }
- scrolling_copy_area(xw, scrolltop + amount, scrollheight, amount);
+ scrolling_copy_area(xw, scrolltop + amount, scrollheight, amount);
- if (refreshheight > 0) {
- ClearCurBackground(xw,
- (int) refreshtop * FontHeight(screen) + screen->border,
- (int) OriginX(screen),
- (unsigned) (refreshheight * FontHeight(screen)),
- (unsigned) Width(screen));
- if (refreshheight > shift)
- refreshheight = shift;
+ if (refreshheight > 0) {
+ ClearCurBackground(xw,
+ (int) refreshtop * FontHeight(screen) + screen->border,
+ (int) OriginX(screen),
+ (unsigned) (refreshheight * FontHeight(screen)),
+ (unsigned) Width(screen));
+ if (refreshheight > shift)
+ refreshheight = shift;
+ }
}
}
@@ -665,7 +682,8 @@ WriteText(XtermWidget xw, IChar * str, Cardinal len)
unsigned cells = visual_width(str, len);
GC currentGC;
- TRACE(("WriteText (%2d,%2d) %3d:%s\n",
+ TRACE(("WriteText %d (%2d,%2d) %3d:%s\n",
+ screen->topline,
screen->cur_row,
screen->cur_col,
len, visibleIChar(str, len)));
@@ -712,9 +730,12 @@ WriteText(XtermWidget xw, IChar * str, Cardinal len)
screen->cur_row));
test = flags;
+#if OPT_ISO_COLORS
if (screen->colorAttrMode) {
fg = MapToColorMode(xw->cur_foreground, screen, flags);
- } else {
+ } else
+#endif
+ {
fg = xw->cur_foreground;
}
checkVeryBoldColors(test, fg);
@@ -2242,7 +2263,9 @@ xtermXftDrawString(XtermWidget xw,
} else
#endif
if ((flags & BOLDATTR(screen))
+#if OPT_ISO_COLORS
&& !screen->colorBDMode
+#endif
&& XFT_FONT(renderWideBold[fontnum])) {
wfont = XFT_FONT(renderWideBold[fontnum]);
} else {
@@ -3369,7 +3392,7 @@ getXtermSizeHints(XtermWidget xw)
* current screen foreground and background colors.
*/
GC
-updatedXtermGC(XtermWidget xw, unsigned flags, CellColor fg_bg, Bool hilite)
+updatedXtermGC(XtermWidget xw, unsigned flags, unsigned fg_bg, Bool hilite)
{
TScreen *screen = TScreenOf(xw);
VTwin *win = WhichVWin(screen);
@@ -3506,7 +3529,7 @@ resetXtermGC(XtermWidget xw, unsigned flags, Bool hilite)
* BOLD or UNDERLINE color-mode active, those will be used.
*/
unsigned
-extract_fg(XtermWidget xw, CellColor color, unsigned flags)
+extract_fg(XtermWidget xw, unsigned color, unsigned flags)
{
unsigned fg = ExtractForeground(color);
@@ -3522,7 +3545,7 @@ extract_fg(XtermWidget xw, CellColor color, unsigned flags)
* If we've got INVERSE color-mode active, that will be used.
*/
unsigned
-extract_bg(XtermWidget xw, CellColor color, unsigned flags)
+extract_bg(XtermWidget xw, unsigned color, unsigned flags)
{
unsigned bg = ExtractBackground(color);
@@ -3887,20 +3910,22 @@ systemWcwidthOk(int samplesize, int samplepass)
#endif /* HAVE_WCWIDTH */
void
-decode_wcwidth(int mode, int samplesize, int samplepass)
+decode_wcwidth(XtermWidget xw)
{
+ int mode = ((xw->misc.cjk_width ? 2 : 0)
+ + (xw->misc.mk_width ? 1 : 0)
+ + 1);
+
switch (mode) {
default:
#if defined(HAVE_WCHAR_H) && defined(HAVE_WCWIDTH)
- if (xtermEnvUTF8() && systemWcwidthOk(samplesize, samplepass)) {
+ if (xtermEnvUTF8() &&
+ systemWcwidthOk(xw->misc.mk_samplesize, xw->misc.mk_samplepass)) {
my_wcwidth = wcwidth;
TRACE(("using system wcwidth() function\n"));
break;
}
/* FALLTHRU */
-#else
- (void) samplesize;
- (void) samplepass;
#endif
case 2:
my_wcwidth = &mk_wcwidth;
@@ -3912,5 +3937,12 @@ decode_wcwidth(int mode, int samplesize, int samplepass)
TRACE(("using MK-CJK wcwidth() function\n"));
break;
}
+
+ for (first_widechar = 128; first_widechar < 4500; ++first_widechar) {
+ if (my_wcwidth((int) first_widechar) > 1) {
+ TRACE(("first_widechar %#x\n", first_widechar));
+ break;
+ }
+ }
}
#endif
diff --git a/app/xterm/uxterm.desktop b/app/xterm/uxterm.desktop
index ddb1f1b92..f2b50dbf7 100644
--- a/app/xterm/uxterm.desktop
+++ b/app/xterm/uxterm.desktop
@@ -1,4 +1,4 @@
-# $XTermId: uxterm.desktop,v 1.7 2007/12/30 15:09:12 tom Exp $
+# $XTermId: uxterm.desktop,v 1.8 2010/03/05 09:51:58 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
@@ -38,4 +38,4 @@ Terminal=false
Type=Application
Encoding=UTF-8
Icon=xterm-color_48x48
-Categories=System;
+Categories=System;TerminalEmulator;
diff --git a/app/xterm/version.h b/app/xterm/version.h
index 61ec78cdf..9082aab21 100644
--- a/app/xterm/version.h
+++ b/app/xterm/version.h
@@ -1,5 +1,5 @@
/*
- * $XTermId: version.h,v 1.313 2010/01/20 01:39:08 tom Exp $
+ * $XTermId: version.h,v 1.316 2010/04/23 08:43:31 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 255
+#define XTERM_PATCH 258
#ifndef __vendorversion__
#define __vendorversion__ "XTerm/OpenBSD"
diff --git a/app/xterm/xstrings.c b/app/xterm/xstrings.c
index fe035fd2a..142f27631 100644
--- a/app/xterm/xstrings.c
+++ b/app/xterm/xstrings.c
@@ -1,8 +1,8 @@
-/* $XTermId: xstrings.c,v 1.36 2009/12/07 09:16:23 tom Exp $ */
+/* $XTermId: xstrings.c,v 1.37 2010/04/04 22:34:17 tom Exp $ */
/************************************************************
-Copyright 2000-2008,2009 by Thomas E. Dickey
+Copyright 2000-2009,2010 by Thomas E. Dickey
All Rights Reserved
@@ -172,7 +172,7 @@ x_strcasecmp(const char *s1, const char *s2)
if (len != strlen(s2))
return 1;
- return x_strncasecmp(s1, s2, len);
+ return x_strncasecmp(s1, s2, (unsigned) len);
}
int
diff --git a/app/xterm/xterm.desktop b/app/xterm/xterm.desktop
index a32fc8548..483ac68e7 100644
--- a/app/xterm/xterm.desktop
+++ b/app/xterm/xterm.desktop
@@ -1,4 +1,4 @@
-# $XTermId: xterm.desktop,v 1.8 2007/12/30 15:09:12 tom Exp $
+# $XTermId: xterm.desktop,v 1.9 2010/03/06 16:17:35 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
@@ -38,4 +38,4 @@ Terminal=false
Type=Application
Encoding=UTF-8
Icon=xterm-color_48x48
-Categories=System;
+Categories=System;TerminalEmulator;
diff --git a/app/xterm/xterm.h b/app/xterm/xterm.h
index 4ae4d82d3..984933184 100644
--- a/app/xterm/xterm.h
+++ b/app/xterm/xterm.h
@@ -1,4 +1,4 @@
-/* $XTermId: xterm.h,v 1.608 2010/01/20 01:36:37 tom Exp $ */
+/* $XTermId: xterm.h,v 1.625 2010/04/18 17:10:42 tom Exp $ */
/************************************************************
@@ -55,7 +55,7 @@ authorization.
#if defined(__GNUC__) && defined(_FORTIFY_SOURCE)
#define USE_IGNORE_RC
-#define IGNORE_RC(func) ignore_unused = func
+#define IGNORE_RC(func) ignore_unused = (int) func
#else
#define IGNORE_RC(func) (void) func
#endif /* gcc workarounds */
@@ -344,6 +344,7 @@ extern char **environ;
#define XtNallowC1Printable "allowC1Printable"
#define XtNallowColorOps "allowColorOps"
#define XtNallowFontOps "allowFontOps"
+#define XtNallowScrollLock "allowScrollLock"
#define XtNallowSendEvents "allowSendEvents"
#define XtNallowTcapOps "allowTcapOps"
#define XtNallowTitleOps "allowTitleOps"
@@ -516,6 +517,7 @@ extern char **environ;
#define XtCAllowC1Printable "AllowC1Printable"
#define XtCAllowColorOps "AllowColorOps"
#define XtCAllowFontOps "AllowFontOps"
+#define XtCAllowScrollLock "AllowScrollLock"
#define XtCAllowSendEvents "AllowSendEvents"
#define XtCAllowTcapOps "AllowTcapOps"
#define XtCAllowTitleOps "AllowTitleOps"
@@ -772,9 +774,8 @@ extern void ReadLineButton PROTO_XT_ACTIONS_ARGS;
#if OPT_WIDE_CHARS
extern Bool iswide(int /* i */);
-#define FIRST_WIDECHAR 256
-#define WideCells(n) (((IChar)(n) >= FIRST_WIDECHAR) ? my_wcwidth((wchar_t) (n)) : 1)
-#define isWide(n) (((IChar)(n) >= FIRST_WIDECHAR) && iswide(n))
+#define WideCells(n) (((IChar)(n) >= first_widechar) ? my_wcwidth((wchar_t) (n)) : 1)
+#define isWide(n) (((IChar)(n) >= first_widechar) && iswide(n))
#else
#define WideCells(n) 1
#endif
@@ -802,7 +803,6 @@ extern void noleaks_cachedCgs (XtermWidget /* xw */);
/* charproc.c */
extern Bool CheckBufPtrs (TScreen * /* screen */);
extern int VTInit (XtermWidget /* xw */);
-extern int v_write (int /* f */, Char * /* d */, unsigned /* len */);
extern void FindFontSelection (XtermWidget /* xw */, const char * /* atom_name */, Bool /* justprobe */);
extern void HideCursor (void);
extern void RestartBlinking(TScreen * /* screen */);
@@ -825,6 +825,7 @@ extern void unparseputc1 (XtermWidget /* xw */, int /* c */);
extern void unparseputn (XtermWidget /* xw */, unsigned /* n */);
extern void unparseputs (XtermWidget /* xw */, const char * /* s */);
extern void unparseseq (XtermWidget /* xw */, ANSI * /* ap */);
+extern void v_write (int /* f */, Char * /* d */, unsigned /* len */);
extern void xtermAddInput(Widget /* w */);
#if OPT_BLINK_CURS
@@ -923,6 +924,7 @@ extern SIGNAL_T Exit (int /* n */);
#endif
#if OPT_WIDE_CHARS
+extern unsigned first_widechar;
extern int (*my_wcwidth)(wchar_t);
#endif
@@ -932,7 +934,7 @@ extern void repairSizeHints (void);
extern void show_8bit_control (Bool /* value */);
/* misc.c */
-extern Bool AllocateTermColor(XtermWidget, ScrnColors *, int, const char *);
+extern Bool AllocateTermColor(XtermWidget, ScrnColors *, int, const char *, Bool);
extern Cursor make_colored_cursor (unsigned /* cursorindex */, unsigned long /* fg */, unsigned long /* bg */);
extern OptionHelp * sortedOpts(OptionHelp *, XrmOptionDescRec *, Cardinal);
extern Window WMFrameWindow(XtermWidget /* termw */);
@@ -972,7 +974,7 @@ extern void ReverseOldColors (void);
extern void SysError (int /* i */) GCC_NORETURN;
extern void VisualBell (void);
extern void do_dcs (XtermWidget /* xw */, Char * /* buf */, size_t /* len */);
-extern void do_osc (XtermWidget /* xw */, Char * /* buf */, unsigned /* len */, int /* final */);
+extern void do_osc (XtermWidget /* xw */, Char * /* buf */, size_t /* len */, int /* final */);
extern void do_xevents (void);
extern void end_tek_mode (void);
extern void end_vt_mode (void);
@@ -1004,6 +1006,19 @@ extern void HandleRestoreSize PROTO_XT_ACTIONS_ARGS;
extern void RequestMaximize (XtermWidget /* termw */, int /* maximize */);
#endif
+#if OPT_SCROLL_LOCK
+extern void GetScrollLock (TScreen * /* screen */);
+extern void HandleScrollLock PROTO_XT_ACTIONS_ARGS;
+extern void ShowScrollLock (TScreen * /* screen */, Bool /* enable */);
+extern void SetScrollLock (TScreen * /* screen */, Bool /* enable */);
+extern void xtermShowLED (TScreen * /* screen */, Cardinal /* led_number */, Bool /* enable */);
+extern void xtermClearLEDs (TScreen * /* screen */);
+#else
+#define ShowScrollLock(screen, enable) /* nothing */
+#define SetScrollLock(screen, enable) /* nothing */
+#define GetScrollLock(screen) /* nothing */
+#endif
+
#if OPT_WIDE_CHARS
extern Bool xtermEnvUTF8(void);
#else
@@ -1087,7 +1102,7 @@ extern void ScrnInsertChar (XtermWidget /* xw */, unsigned /* n */);
extern void ScrnInsertLine (XtermWidget /* xw */, ScrnBuf /* sb */, int /* last */, int /* where */, unsigned /* n */);
extern void ScrnRefresh (XtermWidget /* xw */, int /* toprow */, int /* leftcol */, int /* nrows */, int /* ncols */, Bool /* force */);
extern void ScrnUpdate (XtermWidget /* xw */, int /* toprow */, int /* leftcol */, int /* nrows */, int /* ncols */, Bool /* force */);
-extern void ScrnWriteText (XtermWidget /* xw */, IChar * /* str */, unsigned /* flags */, CellColor /* cur_fg_bg */, unsigned /* length */);
+extern void ScrnWriteText (XtermWidget /* xw */, IChar * /* str */, unsigned /* flags */, unsigned /* cur_fg_bg */, unsigned /* length */);
extern void setupLineData (TScreen * /* screen */, ScrnBuf /* base */, Char * /* data */, unsigned /* nrow */, unsigned /* ncol */);
extern void xtermParseRect (XtermWidget /* xw */, int, int *, XTermRect *);
@@ -1155,7 +1170,7 @@ extern void ScrollBarOff (XtermWidget /* xw */);
extern void ScrollBarOn (XtermWidget /* xw */, Bool /* init */);
extern void ScrollBarReverseVideo (Widget /* scrollWidget */);
extern void ToggleScrollBar (XtermWidget /* xw */);
-extern void WindowScroll (XtermWidget /* xw */, int /* top */);
+extern void WindowScroll (XtermWidget /* xw */, int /* top */, Bool /* always */);
#ifdef SCROLLBAR_RIGHT
extern void updateRightScrollbar(XtermWidget /* xw */);
@@ -1174,7 +1189,7 @@ extern void TabZonk (Tabs /* tabs */);
/* util.c */
extern Boolean isDefaultBackground(const char * /* name */);
extern Boolean isDefaultForeground(const char * /* name */);
-extern GC updatedXtermGC (XtermWidget /* xw */, unsigned /* flags */, CellColor /* fg_bg */, Bool /* hilite */);
+extern GC updatedXtermGC (XtermWidget /* xw */, unsigned /* flags */, unsigned /* fg_bg */, Bool /* hilite */);
extern int AddToRefresh (XtermWidget /* xw */);
extern int ClearInLine (XtermWidget /* xw */, int /* row */, int /* col */, unsigned /* len */);
extern int HandleExposure (XtermWidget /* xw */, XEvent * /* event */);
@@ -1192,7 +1207,7 @@ extern void RevScroll (XtermWidget /* xw */, int /* amount */);
extern void ReverseVideo (XtermWidget /* termw */);
extern void WriteText (XtermWidget /* xw */, IChar * /* str */, Cardinal /* len */);
extern void decode_keyboard_type (XtermWidget /* xw */, struct XTERM_RESOURCE * /* rp */);
-extern void decode_wcwidth (int /* mode */, int /* samplesize */, int /* samplepass */);
+extern void decode_wcwidth (XtermWidget /* xw */);
extern void do_erase_display (XtermWidget /* xw */, int /* param */, int /* mode */);
extern void do_erase_line (XtermWidget /* xw */, int /* param */, int /* mode */);
extern void getXtermSizeHints (XtermWidget /* xw */);
@@ -1210,8 +1225,8 @@ extern void xtermSizeHints (XtermWidget /* xw */, int /* scrollbarWidth */);
#if OPT_ISO_COLORS
-extern unsigned extract_fg (XtermWidget /* xw */, CellColor /* color */, unsigned /* flags */);
-extern unsigned extract_bg (XtermWidget /* xw */, CellColor /* color */, unsigned /* flags */);
+extern unsigned extract_fg (XtermWidget /* xw */, unsigned /* color */, unsigned /* flags */);
+extern unsigned extract_bg (XtermWidget /* xw */, unsigned /* color */, unsigned /* flags */);
extern CellColor makeColorPair (int /* fg */, int /* bg */);
extern void ClearCurBackground (XtermWidget /* xw */, int /* top */, int /* left */, unsigned /* height */, unsigned /* width */);
@@ -1257,7 +1272,7 @@ extern Pixel xtermGetColorRes(XtermWidget /* xw */, ColorRes * /* res */);
&& (screen->veryBoldColors & attr) == 0 \
&& (flags & attr) != 0 \
&& (fg == code)) \
- flags &= ~(attr)
+ UIntClr(flags, attr)
#define checkVeryBoldColors(flags, fg) \
checkVeryBoldAttr(flags, fg, COLOR_RV, INVERSE); \
@@ -1332,6 +1347,9 @@ unsigned visual_width(IChar * /* str */, Cardinal /* len */);
#define BtoS(b) (((b) == Maybe) ? "maybe" : ((b) ? "on" : "off"))
#define NonNull(s) ((s) ? (s) : "<null>")
+#define UIntSet(dst,bits) dst = dst | (unsigned) (bits)
+#define UIntClr(dst,bits) dst = dst & (unsigned) ~(bits)
+
#ifdef __cplusplus
}
#endif
diff --git a/app/xterm/xterm.log.html b/app/xterm/xterm.log.html
index 055cce411..b3aca533d 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.906 2010/01/22 01:00:37 tom Exp $
+ $XTermId: xterm.log.html,v 1.933 2010/05/02 01:07:19 tom Exp $
-->
<HTML>
<HEAD>
@@ -41,7 +41,7 @@
</HEAD>
<BODY>
<HR>
-Copyright &copy; 1997-2008,2009 by <A
+Copyright &copy; 1997-2009,2010 by <A
HREF="mailto:dickey@invisible-island.net">Thomas E. Dickey</A>
<HR>
<H1>Contents</H1>
@@ -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_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>
<LI><A HREF="#xterm_255">Patch #255 - 2010/1/21</A>
<LI><A HREF="#xterm_254">Patch #254 - 2010/1/6</A>
<LI><A HREF="#xterm_253">Patch #253 - 2009/12/10</A>
@@ -314,6 +317,108 @@ is the latest version of this file.
<LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A>
</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
+ rapid scrolling where an empty record is fetched from the
+ scrollback FIFO.
+</ul>
+
+<H1><A NAME="xterm_257">Patch #257 - 2010/4/22</A></H1>
+<ul>
+ <li>correct ctlseqs.ms description of OSC 17 and OSC 19
+ (patch by Emanuele Giaquinta).
+
+ <li>corrected logic for <code>menuLocale</code> resource;
+ the <code>setlocale</code> function returns the original locale
+ only when querying.
+
+ <li>improve filtering of translations resource, narrowing the scope
+ of the <code>alwaysUseMods</code> to address only the translations
+ that would cause a key to be sent to the host (report by Andrew
+ Gaylard).
+
+ <li>change default value of <code>menuLocale</code> resource to "C",
+ to work around
+ longstanding <a href="http://invisible-island.net/xterm/xterm.faq.html#slow_menus">Xorg bug</a>.
+
+ <li>modify handling of <code>scrollKey</code> feature to ignore
+ XON/XOFF keys.
+
+ <li>implement scroll-lock feature.
+
+ <li>revise memory allocation in UTF8toLatin1() to fix an out-of-bounds
+ index (Mandriva #54531).
+
+ <li>compute value for first wide-character rather than assuming it is
+ 256, fixes problem with <code>-cjk_width</code> introduced in
+ patches
+ <a href="#xterm_242">242</a> and
+ <a href="#xterm_249">249</a>
+ (report by Thomas Wolff).
+
+ <li>improve configure script:
+ <ul>
+ <li>corrected check for <code>_XOPEN_SOURCE</code> for OpenSolaris.
+
+ <li>when possible, add rpath option for libraries in unusual places
+
+ <li>add configure option <code>--disable-rpath-hack</code> to
+ control whether the rpath option can be added.
+ </ul>
+
+ <li>modify <code>AllocateTermColor()</code> to separate initialization
+ from control sequences,
+ fixing problem from <a href="#xterm_254">patch #254</a> changes
+ where enabling <code>allowSendEvents</code>
+ resource prevents setting cursor color on command-line
+ (Debian #572928).
+
+ <li>amend logic from <a href="#xterm_185">patch #185</a> to not
+ reallocate cell-array if processing <code>ESC&nbsp;%&nbsp;G</code>
+ to switch from UTF-8 if already in ISO-8859-1 character set
+ (report by Michael Koehne).
+
+ <li>fix to avoid calling <code>XmuInternStrings()</code> with zero
+ count (report by Johan Bockg&#229;rd).
+
+ <li>fix build when --disable-ansi-color configure option is used.
+
+ <li>fix build when neither OPT_TCAP_QUERY or OPT_TCAP_FKEYS is defined
+ (patch by Matthieu Herrb)
+</ul>
+
+<H1><A NAME="xterm_256">Patch #256 - 2010/3/6</A></H1>
+<ul>
+ <li>add TerminalEmulator to desktop category files.
+
+ <li>modify <code>sinstall.sh</code> to ignore the "." appended to
+ permissions by selinux.
+
+ <li>change app-defaults organization, installing UXTerm-color
+ and KOI8XTerm-color for consistent behavior regarding
+ <code>customization:&nbsp;color</code> (prompted by discussion
+ in Ubuntu #421261).
+
+ <li>fix typo in <code>minstall.sh</code> from
+ <a href="#xterm_255">patch #255</a> changes,
+ and add case for
+ <code>/var/run</code> needed for full path of utmp
+ (report by Julien Cristau).
+
+ <li>minor fix to xterm manpage, remove a comment stating that margin
+ bell can be changed via the VT Options menu. That was replaced in
+ <a href="#xterm_225">patch #225</a>
+
+ <li>add a "docs" rule to makefile.
+
+ <li>fix initialization of Atom used for <code>XkbBell</code> feature
+ from <a href="#xterm_243">patch 243</a> changes.
+ Unlike the other calls to <code>XInternAtom()</code>,
+ in this case the flag telling X to create the Atom was unset
+ (patch by Chris Adams).
+</ul>
+
<H1><A NAME="xterm_255">Patch #255 - 2010/1/21</A></H1>
<ul>
<li>rename <code>install.sh</code> to <code>install-sh</code> in case
diff --git a/app/xterm/xterm.man b/app/xterm/xterm.man
index 26638a4ca..8e392b861 100644
--- a/app/xterm/xterm.man
+++ b/app/xterm/xterm.man
@@ -1,5 +1,5 @@
'\" t
-.\" $XTermId: xterm.man,v 1.451 2010/01/20 10:55:58 tom Exp $
+.\" $XTermId: xterm.man,v 1.456 2010/04/16 08:25:08 tom Exp $
.\"
.\" Copyright 1996-2009,2010 by Thomas E. Dickey
.\"
@@ -725,8 +725,6 @@ shell (i.e., it will be a normal \*(``subshell\*('').
.B -mb
This option indicates that \fIxterm\fP should ring a margin bell when
the user types near the right end of a line.
-This option can be turned on
-and off from the \*(``VT Options\*('' menu.
.TP 8
.B +mb
This option indicates that margin bell should not be rung.
@@ -1042,7 +1040,7 @@ This option indicates that \fIxterm\fP should not wait before starting the
subprocess.
.TP 8
.B -ziconbeep \fIpercent\fP
-Same as zIconBeep resource.
+Same as \fBzIconBeep\fP resource.
If percent is non-zero, xterms that produce output while iconified
will cause an XBell sound at the given volume
and have "***" prepended to their icon titles.
@@ -1268,12 +1266,11 @@ the popup menus.
Use this to improve initialization performance of the Athena popup menus,
which may load unnecessary (and very large) fonts, e.g.,
in a locale having UTF-8 encoding.
-The default is an empty string, which uses the current locale setting.
+The default is the "C" (POSIX).
.IP
-Set it to \*(``C\*('' to achieve the best performance using the default
-menu resource settings.
-If you happen to be using localized menu resources,
-set the resource accordingly.
+To use the current locale
+(only useful if you have localized the resource settings for the menu entries),
+set the resource to an empty string.
.TP 8
.B "minBufSize (\fPclass\fB MinBufSize)"
Specify the minimum size of the input buffer, i.e., the amount of data
@@ -1501,6 +1498,12 @@ The default is \*(``true.\*(''
Specifies whether control sequences that set/query the font should be allowed.
The default is \*(``true.\*(''
.TP 8
+.B "allowScrollLock (\fPclass\fB AllowScrollLock)"
+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.\*(''
+.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.
@@ -1607,6 +1610,9 @@ The default is \*(``false.\*(''
Override the \fBnumLock\fP resource, telling \fIxterm\fR to use the Alt and Meta
modifiers to construct parameters for function key sequences even if
those modifiers appear in the translations resource.
+Normally \fIxterm\fP checks if Alt or Meta is used in a translation that
+would conflict with function key modifiers, and will ignore these modifiers
+in that special case.
The default is \*(``false.\*(''
.TP 8
.B "answerbackString (\fPclass\fB AnswerbackString)"
@@ -2882,6 +2888,10 @@ The default is \*(``xterm.\*(''
.B "popOnBell (\fPclass\fB PopOnBell)"
Specifies whether the window would be raised when Control-G is received.
The default is \*(``false.\*(''
+.IP
+If the window is iconified, this has no effect.
+However, the \fBzIconBeep\fP resource provides you with the ability to
+see which iconified windows have sounded a bell.
.TP 8
.B "preeditType (\fPclass\fB XtCPreeditType)"
Tells \fIxterm\fP which types of preedit (preconversion) string to display.
diff --git a/app/xterm/xtermcap.c b/app/xterm/xtermcap.c
index c3139bc7f..0a941de3d 100644
--- a/app/xterm/xtermcap.c
+++ b/app/xterm/xtermcap.c
@@ -1,4 +1,4 @@
-/* $XTermId: xtermcap.c,v 1.41 2010/01/05 00:46:56 tom Exp $ */
+/* $XTermId: xtermcap.c,v 1.42 2010/03/12 00:53:05 Matthieu.Herrb Exp $ */
/*
* Copyright 2007-2009,2010 by Thomas E. Dickey
diff --git a/app/xterm/xtermcfg.h b/app/xterm/xtermcfg.h
index 2b91e9374..f212655fd 100644
--- a/app/xterm/xtermcfg.h
+++ b/app/xterm/xtermcfg.h
@@ -80,11 +80,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define HAVE_WCSWIDTH 1 /* AC_CHECK_FUNCS(wcswidth) */
#define HAVE_WCWIDTH 1 /* AC_CHECK_FUNCS(wcwidth) */
#define HAVE_X11_DECKEYSYM_H 1 /* AC_CHECK_HEADERS(X11/DECkeysym.h) */
+#define HAVE_X11_EXTENSIONS_XKB_H /* AC_CHECK_HEADERS(X11/extensions/XKB.h) */
#define HAVE_X11_SUNKEYSYM_H 1 /* AC_CHECK_HEADERS(X11/Sunkeysym.h) */
#define HAVE_X11_XF86KEYSYM_H 1 /* AC_CHECK_HEADERS(X11/XF86keysym.h) */
+#define HAVE_X11_XKBLIB_H /* AC_CHECK_HEADERS(X11/XKBlib.h) */
#define HAVE_X11_XPOLL_H 1 /* AC_CHECK_HEADERS(X11/Xpoll.h) */
#define HAVE_XFTDRAWSETCLIP 1 /* CF_X_FREETYPE */
#define HAVE_XFTDRAWSETCLIPRECTANGLES 1 /* CF_X_FREETYPE */
+#define HAVE_XKBQUERYEXTENSION /* AC_CHECK_FUNCS(XkbQueryExtension) */
#define HAVE_XKB_BELL_EXT 1 /* CF_XKB_BELL_EXT */
#define LUIT_PATH "/usr/X11R6/bin/luit" /* CF_ARG_ENABLE(luit) */
/* #undef NO_ACTIVE_ICON */ /* CF_ARG_DISABLE(active-icon) */
diff --git a/app/xterm/xtermcfg.hin b/app/xterm/xtermcfg.hin
index ff6a4bbd1..60d919eec 100644
--- a/app/xterm/xtermcfg.hin
+++ b/app/xterm/xtermcfg.hin
@@ -1,8 +1,8 @@
-/* $XTermId: xtermcfg.hin,v 1.178 2009/08/09 17:23:19 tom Exp $ */
+/* $XTermId: xtermcfg.hin,v 1.180 2010/04/21 00:19:23 tom Exp $ */
/************************************************************
-Copyright 1997-2008,2009 by Thomas E. Dickey
+Copyright 1997-2009,2010 by Thomas E. Dickey
All Rights Reserved
@@ -80,11 +80,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#undef HAVE_WCSWIDTH /* AC_CHECK_FUNCS(wcswidth) */
#undef HAVE_WCWIDTH /* AC_CHECK_FUNCS(wcwidth) */
#undef HAVE_X11_DECKEYSYM_H /* AC_CHECK_HEADERS(X11/DECkeysym.h) */
+#undef HAVE_X11_EXTENSIONS_XKB_H /* AC_CHECK_HEADERS(X11/extensions/XKB.h) */
#undef HAVE_X11_SUNKEYSYM_H /* AC_CHECK_HEADERS(X11/Sunkeysym.h) */
#undef HAVE_X11_XF86KEYSYM_H /* AC_CHECK_HEADERS(X11/XF86keysym.h) */
+#undef HAVE_X11_XKBLIB_H /* AC_CHECK_HEADERS(X11/XKBlib.h) */
#undef HAVE_X11_XPOLL_H /* AC_CHECK_HEADERS(X11/Xpoll.h) */
#undef HAVE_XFTDRAWSETCLIP /* CF_X_FREETYPE */
#undef HAVE_XFTDRAWSETCLIPRECTANGLES /* CF_X_FREETYPE */
+#undef HAVE_XKBQUERYEXTENSION /* AC_CHECK_FUNCS(XkbQueryExtension) */
#undef HAVE_XKB_BELL_EXT /* CF_XKB_BELL_EXT */
#undef LUIT_PATH /* CF_ARG_ENABLE(luit) */
#undef NO_ACTIVE_ICON /* CF_ARG_DISABLE(active-icon) */