summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2009-04-04 15:10:46 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2009-04-04 15:10:46 +0000
commit3f1e1ec27086e513778a2fc86e249a11ab92fe41 (patch)
tree75e82b3c8cc0a7321b566c0f831566abb383dae2
parent142e50ea1b148e92d0c6d2b57c5895e7d6b7065a (diff)
Update to xterm 243. tested by naddy@.
Patch #243 - 2009/3/28 * revert change to default for allowTcapOps (request by Bram Moolenaar). * reallocate result returned by xtermEnvLocale() to avoid reference to freed memory after handling menuLocale resource. * fix an old (X11R5) bug in tek4014 for switching fontsizes. * add resource defaultString to make configurable the use of "#" when pastes of UTF-8 text fail due to limitations in the current locale settings. * make the set of selection target Atom's configurable by two new resources eightBitSelectTypes and utf8SelectTypes, e.g., to use the TEXT Atom in preference to UTF8_STRING (discussion with Stanislav Sedov regarding koi8rxterm and the FreeBSD port). * modify handling of TARGETS Atom by making it return exactly the set of targets as those which xterm is currently providing. * set MANPAGER and PAGER explicitly to /bin/cat in minstall.sh to work around /etc/man.conf's with those variables already set (report by Mar'yasin Semion). * improve error-checking of tcap-query parser. * add check for keyboard tcap), which ensures that terminal descriptions containing the same string for shifted/unshifted keys will be seen by tcap-query as only the unshifted key. (This would only happen with an incorrect terminal description). * fix conversion for input event-state to modifier-parameter which made tcap-query feature not work with tcapFunctionKeys (keyboard type tcap). * add "DEF_ALLOW_XXX" definitions to main.h to allow overriding the default compiled-in values for "allowxxx" resources. * remove check on bell-percentage added in patch #242, which disallowed zero/negative values (Redhat Bugzilla #487829).
-rw-r--r--app/xterm/MANIFEST2
-rw-r--r--app/xterm/Makefile6
-rw-r--r--app/xterm/Tekproc.c55
-rw-r--r--app/xterm/button.c336
-rw-r--r--app/xterm/cachedGCs.c6
-rw-r--r--app/xterm/charproc.c27
-rw-r--r--app/xterm/input.c80
-rw-r--r--app/xterm/main.h18
-rw-r--r--app/xterm/menu.c32
-rw-r--r--app/xterm/minstall.sh35
-rw-r--r--app/xterm/misc.c33
-rw-r--r--app/xterm/ptyx.h11
-rw-r--r--app/xterm/trace.c27
-rw-r--r--app/xterm/trace.h15
-rw-r--r--app/xterm/util.c8
-rw-r--r--app/xterm/version.h4
-rw-r--r--app/xterm/xterm.h17
-rw-r--r--app/xterm/xterm.log.html54
-rw-r--r--app/xterm/xterm.man127
-rw-r--r--app/xterm/xtermcap.c252
-rw-r--r--app/xterm/xtermcap.h13
21 files changed, 844 insertions, 314 deletions
diff --git a/app/xterm/MANIFEST b/app/xterm/MANIFEST
index 3aa34dbcb..0a8ae68ad 100644
--- a/app/xterm/MANIFEST
+++ b/app/xterm/MANIFEST
@@ -1,4 +1,4 @@
-MANIFEST for xterm-242, version xterm-242
+MANIFEST for xterm-243, version xterm-243
--------------------------------------------------------------------------------
MANIFEST this file
256colres.h resource-definitions for 256-color mode
diff --git a/app/xterm/Makefile b/app/xterm/Makefile
index 37e18b6f9..13cff4c46 100644
--- a/app/xterm/Makefile
+++ b/app/xterm/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.11 2008/03/25 23:41:50 matthieu Exp $
+# $OpenBSD: Makefile,v 1.12 2009/04/04 15:10:44 matthieu Exp $
.include <bsd.xconf.mk>
SUBDIR= icons resize
@@ -12,7 +12,9 @@ BINMODE= 2755
CPPFLAGS+= -I${.CURDIR} -I${X11BASE}/include \
-I${X11BASE}/include/freetype2 \
-DHAVE_CONFIG_H -DCSRG_BASED \
- -DFUNCPROTO=15 -DNARROWPROTO -DXFREE86_FT2 -DUTMP
+ -DFUNCPROTO=15 -DNARROWPROTO -DXFREE86_FT2 -DUTMP \
+ -DDEF_ALLOW_FONT=False -DDEF_ALLOW_TCAP=False \
+ -DDEF_ALLOW_WINDOW=False
LDADD+= -L${X11BASE}/lib -lXaw -lXpm -lXt -lSM -lICE \
-lXmu -lXft -lXrender -lX11 -lXext -lXau -lXdmcp \
-lfontconfig -lexpat -lfreetype -lutil -ltermcap -lz
diff --git a/app/xterm/Tekproc.c b/app/xterm/Tekproc.c
index d982366ba..608146832 100644
--- a/app/xterm/Tekproc.c
+++ b/app/xterm/Tekproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: Tekproc.c,v 1.163 2009/02/13 20:01:21 tom Exp $ */
+/* $XTermId: Tekproc.c,v 1.167 2009/03/28 17:03:35 tom Exp $ */
/*
* Warning, there be crufty dragons here.
@@ -899,8 +899,8 @@ TekClear(TekWidget tw)
static void
TekConfigure(Widget w)
{
- if (IsTekWidget(w)) {
- TekWidget tw = (TekWidget) w;
+ TekWidget tw = getTekWidget(w);
+ if (tw != 0) {
TekScreen *tekscr = TekScreenOf(tw);
TScreen *screen = TScreenOf(term);
int border = 2 * screen->border;
@@ -924,11 +924,11 @@ TekExpose(Widget w,
XEvent * event GCC_UNUSED,
Region region GCC_UNUSED)
{
- if (IsTekWidget(w)) {
- TekWidget tw = (TekWidget) w;
+ TekWidget tw = getTekWidget(w);
+ if (tw != 0) {
TekScreen *tekscr = TekScreenOf(tw);
- TRACE(("TekExpose\n"));
+ TRACE(("TekExpose {{\n"));
#ifdef lint
region = region;
@@ -939,8 +939,8 @@ TekExpose(Widget w,
Tpushback = Tpushb;
tekscr->cur_X = 0;
tekscr->cur_Y = TEKHOME;
- TekSetFontSize(tw, tekscr->page.fontsize);
tekscr->cur = tekscr->page;
+ TekSetFontSize(tw, tekscr->cur.fontsize);
tekscr->margin = MARGIN1;
if (tekscr->TekGIN) {
tekscr->TekGIN = NULL;
@@ -954,6 +954,7 @@ TekExpose(Widget w,
first_map_occurred();
if (!tekscr->waitrefresh)
TekRefresh(tw);
+ TRACE(("}} TekExpose\n"));
}
}
@@ -981,6 +982,7 @@ TekRefresh(TekWidget tw)
void
TekRepaint(TekWidget tw)
{
+ TRACE(("TekRepaint\n"));
TekClear(tw);
TekExpose((Widget) tw, (XEvent *) NULL, (Region) NULL);
}
@@ -1657,7 +1659,7 @@ TekSetFontSize(TekWidget tw, int newitem)
int newsize = MI2FS(newitem);
Font fid;
- TRACE(("TekSetFontSize(%d)\n", newitem));
+ TRACE(("TekSetFontSize(%d) size %d ->%d\n", newitem, oldsize, newsize));
if (newsize < 0 || newsize >= TEKNUMFONTS) {
Bell(XkbBI_MinorError, 0);
} else if (oldsize != newsize) {
@@ -1665,6 +1667,9 @@ TekSetFontSize(TekWidget tw, int newitem)
TCursorToggle(tw, TOGGLE);
set_tekfont_menu_item(oldsize, False);
+ tekscr->cur.fontsize = newsize;
+ tekscr->page.fontsize = newsize;
+
fid = tw->tek.Tfont[newsize]->fid;
if (fid == DefaultGCID) {
/* we didn't succeed in opening a real font
@@ -1676,10 +1681,15 @@ TekSetFontSize(TekWidget tw, int newitem)
XSetFont(XtDisplay(tw), tekscr->TnormalGC, fid);
}
- tekscr->cur.fontsize = newsize;
set_tekfont_menu_item(newsize, True);
if (!Ttoggled)
TCursorToggle(tw, TOGGLE);
+
+ /* we'll get an exposure event after changing fontsize, so we
+ * have to clear the screen to avoid painting over the previous
+ * text.
+ */
+ TekClear(tw);
}
}
}
@@ -1796,6 +1806,7 @@ TCursorToggle(TekWidget tw, int toggle) /* TOGGLE or CLEAR */
if (!TEK4014_SHOWN(term))
return;
+ TRACE(("TCursorToggle %s\n", (toggle == TOGGLE) ? "toggle" : "clear"));
c = tekscr->cur.fontsize;
cellwidth = (unsigned) tw->tek.Tfont[c]->max_bounds.width;
cellheight = (unsigned) (tw->tek.Tfont[c]->ascent +
@@ -1893,8 +1904,8 @@ HandleGINInput(Widget w,
String * param_list,
Cardinal *nparamsp)
{
- if (IsTekWidget(w)) {
- TekWidget tw = (TekWidget) w;
+ TekWidget tw = getTekWidget(w);
+ if (tw != 0) {
TekScreen *tekscr = TekScreenOf(tw);
if (tekscr->TekGIN && *nparamsp == 1) {
@@ -1918,3 +1929,25 @@ HandleGINInput(Widget w,
}
}
}
+
+/*
+ * Check if the current widget, or any parent, is the VT100 "xterm" widget.
+ */
+TekWidget
+getTekWidget(Widget w)
+{
+ TekWidget xw;
+
+ if (w == 0) {
+ xw = (TekWidget) CURRENT_EMU();
+ if (!IsTekWidget(xw)) {
+ xw = 0;
+ }
+ } else if (IsTekWidget(w)) {
+ xw = (TekWidget) w;
+ } else {
+ xw = getTekWidget(XtParent(w));
+ }
+ TRACE2(("getTekWidget %p -> %p\n", w, xw));
+ return xw;
+}
diff --git a/app/xterm/button.c b/app/xterm/button.c
index 70e8ffc1a..86e739227 100644
--- a/app/xterm/button.c
+++ b/app/xterm/button.c
@@ -1,4 +1,4 @@
-/* $XTermId: button.c,v 1.306 2009/02/13 21:09:08 tom Exp $ */
+/* $XTermId: button.c,v 1.320 2009/03/27 00:00:56 tom Exp $ */
/*
* Copyright 1999-2008,2009 by Thomas E. Dickey
@@ -1076,12 +1076,12 @@ DECtoASCII(unsigned ch)
*/
#if OPT_WIDE_CHARS
static Char *
-UTF8toLatin1(Char * s, unsigned len, unsigned long *result)
+UTF8toLatin1(TScreen * screen, Char * s, unsigned len, unsigned long *result)
{
static Char *buffer;
static Cardinal used;
- Char *q;
+ Char *p, *q;
if (len > used) {
used = 1 + (2 * len);
@@ -1094,9 +1094,11 @@ UTF8toLatin1(Char * s, unsigned len, unsigned long *result)
q = buffer;
fakePtyData(&data, s, s + len);
while (decodeUtf8(&data)) {
+ Bool fails = False;
+ Bool extra = False;
IChar value = skipPtyData(&data);
if (value == UCS_REPL) {
- *q++ = '#';
+ fails = True;
} else if (value < 256) {
*q++ = CharOf(value);
} else {
@@ -1105,13 +1107,33 @@ UTF8toLatin1(Char * s, unsigned len, unsigned long *result)
*q++ = (Char) DECtoASCII(eqv);
} else {
eqv = AsciiEquivs(value);
- if (eqv == value)
- eqv = '#';
- *q++ = (Char) eqv;
+ if (eqv == value) {
+ fails = True;
+ } else {
+ *q++ = (Char) eqv;
+ }
if (isWide((wchar_t) value))
- *q++ = ' ';
+ extra = True;
+ }
+ }
+
+ /*
+ * If we're not able to plug in a single-byte result, insert the
+ * defaultString (which normally is a single "#", but could be
+ * whatever the user wants).
+ */
+ 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;
}
}
+ if (extra)
+ *q++ = ' ';
}
*q = 0;
*result = (unsigned long) (q - buffer);
@@ -1122,64 +1144,208 @@ UTF8toLatin1(Char * s, unsigned len, unsigned long *result)
}
#endif /* OPT_WIDE_CHARS */
-static Atom *
-_SelectionTargets(Widget w)
+static char *
+parseItem(char *value, char *nextc)
{
- static Atom *eightBitSelectionTargets = NULL;
- TScreen *screen;
- int n;
+ char *nextp = value;
+ while (*nextp != '\0' && *nextp != ',') {
+ *nextp = x_toupper(*nextp);
+ ++nextp;
+ }
+ *nextc = *nextp;
+ *nextp = '\0';
+ x_strtrim(value);
+
+ return nextp;
+}
+
+/*
+ * All of the wanted strings are unique in the first character, so we can
+ * use simple abbreviations.
+ */
+static Bool
+sameItem(const char *actual, const char *wanted)
+{
+ Bool result = False;
+ size_t have = strlen(actual);
+ size_t need = strlen(wanted);
+
+ if (have != 0 && have <= need) {
+ if (!strncmp(actual, wanted, have)) {
+ TRACE(("...matched \"%s\"\n", wanted));
+ result = True;
+ }
+ }
+
+ return result;
+}
+/*
+ * Handle the eightBitSelectTypes or utf8SelectTypes resource values.
+ */
+static Bool
+overrideTargets(Widget w, String value, Atom ** resultp)
+{
+ Bool override = False;
XtermWidget xw;
- if ((xw = getXtermWidget(w)) == 0)
- return NULL;
+ if ((xw = getXtermWidget(w)) != 0) {
+ TScreen *screen = TScreenOf(xw);
- screen = TScreenOf(xw);
+ if (value != 0 && *value != '\0') {
+ String copied = x_strdup(value);
+ if (copied != 0) {
+ Atom *result = 0;
+ Cardinal count = 1;
+ int n;
+
+ TRACE(("decoding SelectTypes \"%s\"\n", value));
+ for (n = 0; copied[n] != '\0'; ++n) {
+ if (copied[n] == ',')
+ ++count;
+ }
+ result = (Atom *) XtMalloc(((2 * count) + 1) * sizeof(Atom));
+ if (result == NULL) {
+ TRACE(("Couldn't allocate selection types\n"));
+ } else {
+ char nextc = '?';
+ char *listp = copied;
+ count = 0;
+ do {
+ char *nextp = parseItem(listp, &nextc);
+ size_t len = strlen(listp);
+
+ if (len == 0) {
+ ;
+ }
+#if OPT_WIDE_CHARS
+ else if (sameItem(listp, "UTF8")) {
+ result[count++] = XA_UTF8_STRING(XtDisplay(w));
+ }
+#endif
+ else if (sameItem(listp, "I18N")) {
+ if (screen->i18nSelections) {
+ result[count++] = XA_TEXT(XtDisplay(w));
+ result[count++] = XA_COMPOUND_TEXT(XtDisplay(w));
+ }
+ } else if (sameItem(listp, "TEXT")) {
+ result[count++] = XA_TEXT(XtDisplay(w));
+ } else if (sameItem(listp, "COMPOUND_TEXT")) {
+ result[count++] = XA_COMPOUND_TEXT(XtDisplay(w));
+ } else if (sameItem(listp, "STRING")) {
+ result[count++] = XA_STRING;
+ }
+ *nextp++ = nextc;
+ listp = nextp;
+ } while (nextc != '\0');
+ if (count) {
+ result[count] = None;
+ override = True;
+ *resultp = result;
+ } else {
+ XtFree((char *) result);
+ }
+ }
+ } else {
+ TRACE(("Couldn't allocate copy of selection types\n"));
+ }
+ }
+ }
+ return override;
+}
#if OPT_WIDE_CHARS
- if (screen->wide_chars) {
- static Atom *utf8SelectionTargets = NULL;
+static Atom *
+allocUtf8Targets(Widget w, TScreen * screen)
+{
+ Atom **resultp = &(screen->selection_targets_utf8);
- if (utf8SelectionTargets == NULL) {
- utf8SelectionTargets = (Atom *) XtMalloc(5 * sizeof(Atom));
- if (utf8SelectionTargets == NULL) {
- TRACE(("Couldn't allocate utf8SelectionTargets\n"));
- return NULL;
- }
- n = 0;
- utf8SelectionTargets[n++] = XA_UTF8_STRING(XtDisplay(w));
+ if (*resultp == 0) {
+ Atom *result;
+
+ if (!overrideTargets(w, screen->utf8_select_types, &result)) {
+ result = (Atom *) XtMalloc(5 * sizeof(Atom));
+ if (result == NULL) {
+ TRACE(("Couldn't allocate utf-8 selection targets\n"));
+ } else {
+ int n = 0;
+
+ result[n++] = XA_UTF8_STRING(XtDisplay(w));
#ifdef X_HAVE_UTF8_STRING
- if (screen->i18nSelections) {
- utf8SelectionTargets[n++] = XA_TEXT(XtDisplay(w));
- utf8SelectionTargets[n++] = XA_COMPOUND_TEXT(XtDisplay(w));
- }
+ if (screen->i18nSelections) {
+ result[n++] = XA_TEXT(XtDisplay(w));
+ result[n++] = XA_COMPOUND_TEXT(XtDisplay(w));
+ }
#endif
- utf8SelectionTargets[n++] = XA_STRING;
- utf8SelectionTargets[n] = None;
+ result[n++] = XA_STRING;
+ result[n] = None;
+ }
}
- return utf8SelectionTargets;
+
+ *resultp = result;
}
+
+ return *resultp;
+}
#endif
- /* not screen->wide_chars */
- if (eightBitSelectionTargets == NULL) {
- eightBitSelectionTargets = (Atom *) XtMalloc(5 * sizeof(Atom));
- if (eightBitSelectionTargets == NULL) {
- TRACE(("Couldn't allocate eightBitSelectionTargets\n"));
- return NULL;
- }
- n = 0;
+static Atom *
+alloc8bitTargets(Widget w, TScreen * screen)
+{
+ Atom **resultp = &(screen->selection_targets_8bit);
+
+ if (*resultp == 0) {
+ Atom *result = 0;
+
+ if (!overrideTargets(w, screen->eightbit_select_types, &result)) {
+ result = (Atom *) XtMalloc(5 * sizeof(Atom));
+ if (result == NULL) {
+ TRACE(("Couldn't allocate 8bit selection targets\n"));
+ } else {
+ int n = 0;
+
#ifdef X_HAVE_UTF8_STRING
- eightBitSelectionTargets[n++] = XA_UTF8_STRING(XtDisplay(w));
+ result[n++] = XA_UTF8_STRING(XtDisplay(w));
+#endif
+ if (screen->i18nSelections) {
+ result[n++] = XA_TEXT(XtDisplay(w));
+ result[n++] = XA_COMPOUND_TEXT(XtDisplay(w));
+ }
+ result[n++] = XA_STRING;
+ result[n] = None;
+ }
+ }
+
+ *resultp = result;
+ }
+
+ return *resultp;
+}
+
+static Atom *
+_SelectionTargets(Widget w)
+{
+ Atom *result;
+ TScreen *screen;
+ XtermWidget xw;
+
+ if ((xw = getXtermWidget(w)) == 0) {
+ result = NULL;
+ } else {
+ screen = TScreenOf(xw);
+
+#if OPT_WIDE_CHARS
+ if (screen->wide_chars) {
+ result = allocUtf8Targets(w, screen);
+ } else
#endif
- if (screen->i18nSelections) {
- eightBitSelectionTargets[n++] = XA_TEXT(XtDisplay(w));
- eightBitSelectionTargets[n++] = XA_COMPOUND_TEXT(XtDisplay(w));
+ {
+ /* not screen->wide_chars */
+ result = alloc8bitTargets(w, screen);
}
- eightBitSelectionTargets[n++] = XA_STRING;
- eightBitSelectionTargets[n] = None;
}
- return eightBitSelectionTargets;
+
+ return result;
}
#define isSELECT(value) (!strcmp(value, "SELECT"))
@@ -1321,14 +1487,16 @@ xtermGetSelection(Widget w,
if ((xw = getXtermWidget(w)) == 0)
return;
- TRACE(("xtermGetSelection\n"));
+ TRACE(("xtermGetSelection num_params %d\n", num_params));
params = MapSelections(xw, params, num_params);
XmuInternStrings(XtDisplay(w), params, (Cardinal) 1, &selection);
cutbuffer = CutBuffer(selection);
- TRACE(("Cutbuffer: %d, target: %lu\n", cutbuffer,
- targets ? (unsigned long) targets[0] : 0));
+ TRACE(("Cutbuffer: %d, target: %s\n", cutbuffer,
+ (targets
+ ? visibleSelectionTarget(XtDisplay(w), targets[0])
+ : "None")));
if (cutbuffer >= 0) {
int inbytes;
@@ -1618,6 +1786,11 @@ SelectionReceived(Widget w,
text_prop.format = *format;
text_prop.nitems = *length;
+ TRACE(("SelectionReceived %s format %d, nitems %ld\n",
+ visibleSelectionTarget(dpy, text_prop.encoding),
+ text_prop.format,
+ text_prop.nitems));
+
#if OPT_WIDE_CHARS
if (screen->wide_chars) {
if (*type == XA_UTF8_STRING(dpy) ||
@@ -1664,7 +1837,7 @@ SelectionReceived(Widget w,
for (i = 0; i < text_list_count; ++i) {
data = (Char *) text_list[i];
size = strlen(text_list[i]) + 1;
- data = UTF8toLatin1(data, size, &size);
+ data = UTF8toLatin1(screen, data, size, &size);
new_size += size + 1;
}
new_text_list =
@@ -1673,7 +1846,7 @@ SelectionReceived(Widget w,
for (i = 0; i < text_list_count; ++i) {
data = (Char *) text_list[i];
size = strlen(text_list[i]) + 1;
- data = UTF8toLatin1(data, size, &size);
+ data = UTF8toLatin1(screen, data, size, &size);
memcpy(tmp, data, size + 1);
new_text_list[i] = tmp;
tmp += size + 1;
@@ -1737,6 +1910,8 @@ SelectionReceived(Widget w,
fail:
if (client_data != 0) {
struct _SelectionList *list = (struct _SelectionList *) client_data;
+
+ TRACE(("SelectionReceived ->xtermGetSelection\n"));
xtermGetSelection(w, list->time,
list->params, list->count, list->targets);
XtFree((char *) client_data);
@@ -3012,15 +3187,14 @@ SaltTextAway(XtermWidget xw,
TScreen *screen = TScreenOf(xw);
int i, j = 0;
int eol;
+ int tmp;
Char *line;
Char *lp;
CELL first = *cellc;
CELL last = *cell;
if (isSameRow(&first, &last) && first.col > last.col) {
- int tmp = first.col;
- first.col = last.col;
- last.col = tmp;
+ EXCHANGE(first.col, last.col, tmp);
}
--last.col;
@@ -3259,6 +3433,9 @@ ConvertSelection(Widget w,
if (screen->selection_data == NULL)
return False; /* can this happen? */
+ TRACE(("ConvertSelection %s\n",
+ visibleSelectionTarget(dpy, *target)));
+
if (*target == XA_TARGETS(dpy)) {
Atom *allocP;
Atom *targetP;
@@ -3266,10 +3443,12 @@ ConvertSelection(Widget w,
XPointer std_return = 0;
unsigned long std_length;
- TRACE(("ConvertSelection XA_TARGETS(dpy)\n"));
if (XmuConvertStandardSelection(w, screen->selection_time, selection,
target, type, &std_return,
&std_length, format)) {
+ Atom *my_targets = _SelectionTargets(w);
+
+ TRACE(("XmuConvertStandardSelection - success\n"));
std_targets = (Atom *) (std_return);
*length = std_length + 6;
@@ -3278,18 +3457,9 @@ ConvertSelection(Widget w,
*value = (XtPointer) targetP;
- *targetP++ = XA_STRING;
- *targetP++ = XA_TEXT(dpy);
-#ifdef X_HAVE_UTF8_STRING
- *targetP++ = XA_COMPOUND_TEXT(dpy);
- *targetP++ = XA_UTF8_STRING(dpy);
-#else
- *targetP = XA_COMPOUND_TEXT(dpy);
- if_OPT_WIDE_CHARS(screen, {
- *targetP = XA_UTF8_STRING(dpy);
- });
- targetP++;
-#endif
+ while (*my_targets != None) {
+ *targetP++ = *my_targets++;
+ }
*targetP++ = XA_LENGTH(dpy);
*targetP++ = XA_LIST_LENGTH(dpy);
@@ -3300,37 +3470,39 @@ ConvertSelection(Widget w,
*type = XA_ATOM;
*format = 32;
result = True;
+ } else {
+ TRACE(("XmuConvertStandardSelection - failed\n"));
}
}
#if OPT_WIDE_CHARS
else if (screen->wide_chars && *target == XA_STRING) {
- TRACE(("ConvertSelection XA_STRING - wide\n"));
result =
_ConvertSelectionHelper(w,
type, value, length, format,
Xutf8TextListToTextProperty,
XStringStyle);
+ TRACE(("...Xutf8TextListToTextProperty:%d\n", result));
} else if (screen->wide_chars && *target == XA_UTF8_STRING(dpy)) {
- TRACE(("ConvertSelection XA_UTF8_STRING(dpy) - wide\n"));
result =
_ConvertSelectionHelper(w,
type, value, length, format,
Xutf8TextListToTextProperty,
XUTF8StringStyle);
+ TRACE(("...Xutf8TextListToTextProperty:%d\n", result));
} else if (screen->wide_chars && *target == XA_TEXT(dpy)) {
- TRACE(("ConvertSelection XA_TEXT(dpy) - wide\n"));
result =
_ConvertSelectionHelper(w,
type, value, length, format,
Xutf8TextListToTextProperty,
XStdICCTextStyle);
+ TRACE(("...Xutf8TextListToTextProperty:%d\n", result));
} else if (screen->wide_chars && *target == XA_COMPOUND_TEXT(dpy)) {
- TRACE(("ConvertSelection XA_COMPOUND_TEXT(dpy) - wide\n"));
result =
_ConvertSelectionHelper(w,
type, value, length, format,
Xutf8TextListToTextProperty,
XCompoundTextStyle);
+ TRACE(("...Xutf8TextListToTextProperty:%d\n", result));
}
#endif
@@ -3341,56 +3513,56 @@ ConvertSelection(Widget w,
properly internationalised, and dump raw eight-bit data
with no conversion into the selection. Yes, this breaks
the ICCCM in non-Latin-1 locales. */
- TRACE(("ConvertSelection XA_STRING\n"));
*type = XA_STRING;
*value = (XtPointer) screen->selection_data;
*length = screen->selection_length;
*format = 8;
result = True;
+ TRACE(("...raw 8-bit data:%d\n", result));
} else if (*target == XA_TEXT(dpy)) { /* not wide_chars */
- TRACE(("ConvertSelection XA_TEXT(dpy)\n"));
result =
_ConvertSelectionHelper(w,
type, value, length, format,
XmbTextListToTextProperty,
XStdICCTextStyle);
+ TRACE(("...XmbTextListToTextProperty(StdICC):%d\n", result));
} else if (*target == XA_COMPOUND_TEXT(dpy)) { /* not wide_chars */
- TRACE(("ConvertSelection XA_COMPOUND_TEXT(dpy)\n"));
result =
_ConvertSelectionHelper(w,
type, value, length, format,
XmbTextListToTextProperty,
XCompoundTextStyle);
+ TRACE(("...XmbTextListToTextProperty(Compound):%d\n", result));
}
#ifdef X_HAVE_UTF8_STRING
else if (*target == XA_UTF8_STRING(dpy)) { /* not wide_chars */
- TRACE(("ConvertSelection XA_UTF8_STRING(dpy)\n"));
result =
_ConvertSelectionHelper(w,
type, value, length, format,
XmbTextListToTextProperty,
XUTF8StringStyle);
+ TRACE(("...XmbTextListToTextProperty(UTF8):%d\n", result));
}
#endif
else if (*target == XA_LIST_LENGTH(dpy)) {
- TRACE(("ConvertSelection XA_LIST_LENGTH(dpy)\n"));
result = SaveConvertedLength(value, 1);
*type = XA_INTEGER;
*length = 1;
*format = 32;
+ TRACE(("...list of values:%d\n", result));
} else if (*target == XA_LENGTH(dpy)) {
- TRACE(("ConvertSelection XA_LENGTH(dpy)\n"));
/* This value is wrong if we have UTF-8 text */
result = SaveConvertedLength(value, screen->selection_length);
*type = XA_INTEGER;
*length = 1;
*format = 32;
+ TRACE(("...list of values:%d\n", result));
} else if (XmuConvertStandardSelection(w,
screen->selection_time, selection,
target, type, (XPointer *) value,
length, format)) {
- TRACE(("ConvertSelection XmuConvertStandardSelection\n"));
result = True;
+ TRACE(("...XmuConvertStandardSelection:%d\n", result));
}
/* else */
@@ -3458,7 +3630,7 @@ _OwnSelection(XtermWidget xw,
if (screen->selection_length == 0)
return;
- TRACE(("_OwnSelection\n"));
+ TRACE(("_OwnSelection count %d\n", count));
selections = MapSelections(xw, selections, count);
if (count > screen->sel_atoms_size) {
@@ -3486,7 +3658,7 @@ _OwnSelection(XtermWidget xw,
unsigned long length = screen->selection_length;
Char *data = screen->selection_data;
if_OPT_WIDE_CHARS((screen), {
- data = UTF8toLatin1(data, length, &length);
+ data = UTF8toLatin1(screen, data, length, &length);
});
TRACE(("XStoreBuffer(%d)\n", cutbuffer));
XStoreBuffer(XtDisplay((Widget) xw),
diff --git a/app/xterm/cachedGCs.c b/app/xterm/cachedGCs.c
index 88819fc78..3c525ee5e 100644
--- a/app/xterm/cachedGCs.c
+++ b/app/xterm/cachedGCs.c
@@ -1,4 +1,4 @@
-/* $XTermId: cachedGCs.c,v 1.51 2009/02/13 00:37:46 tom Exp $ */
+/* $XTermId: cachedGCs.c,v 1.52 2009/03/26 23:59:32 tom Exp $ */
/************************************************************
@@ -812,9 +812,7 @@ swapCgs(XtermWidget xw, VTwin * cgsWin, CgsEnum dstCgsId, CgsEnum srcCgsId)
int srcIndex = dataIndex(src);
int dstIndex = dataIndex(dst);
- tmp = *dst;
- *dst = *src;
- *src = tmp;
+ EXCHANGE(*src, *dst, tmp);
relinkData(src, dstIndex);
relinkData(dst, srcIndex);
diff --git a/app/xterm/charproc.c b/app/xterm/charproc.c
index 12fa232c3..11964d3ac 100644
--- a/app/xterm/charproc.c
+++ b/app/xterm/charproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: charproc.c,v 1.892 2009/02/13 21:15:35 tom Exp $ */
+/* $XTermId: charproc.c,v 1.897 2009/03/29 00:23:12 tom Exp $ */
/*
@@ -395,10 +395,10 @@ static XtActionsRec actionsList[] = {
static XtResource resources[] =
{
Bres(XtNallowSendEvents, XtCAllowSendEvents, screen.allowSendEvent0, False),
- Bres(XtNallowFontOps, XtCAllowFontOps, screen.allowFontOp0, False),
- Bres(XtNallowTcapOps, XtCAllowTcapOps, screen.allowTcapOp0, False),
- Bres(XtNallowTitleOps, XtCAllowTitleOps, screen.allowTitleOp0, True),
- Bres(XtNallowWindowOps, XtCAllowWindowOps, screen.allowWindowOp0, False),
+ Bres(XtNallowFontOps, XtCAllowFontOps, screen.allowFontOp0, DEF_ALLOW_FONT),
+ Bres(XtNallowTcapOps, XtCAllowTcapOps, screen.allowTcapOp0, DEF_ALLOW_TCAP),
+ Bres(XtNallowTitleOps, XtCAllowTitleOps, screen.allowTitleOp0, DEF_ALLOW_TITLE),
+ Bres(XtNallowWindowOps, XtCAllowWindowOps, screen.allowWindowOp0, DEF_ALLOW_WINDOW),
Bres(XtNaltIsNotMeta, XtCAltIsNotMeta, screen.alt_is_not_meta, False),
Bres(XtNaltSendsEscape, XtCAltSendsEscape, screen.alt_sends_esc, False),
Bres(XtNalwaysBoldMode, XtCAlwaysBoldMode, screen.always_bold_mode, False),
@@ -474,10 +474,14 @@ static XtResource resources[] =
Sres(XtNfont4, XtCFont4, screen.MenuFontName(fontMenu_font4), NULL),
Sres(XtNfont5, XtCFont5, screen.MenuFontName(fontMenu_font5), NULL),
Sres(XtNfont6, XtCFont6, screen.MenuFontName(fontMenu_font6), NULL),
+
Sres(XtNanswerbackString, XtCAnswerbackString, screen.answer_back, ""),
Sres(XtNboldFont, XtCBoldFont, misc.default_font.f_b, DEFBOLDFONT),
Sres(XtNcharClass, XtCCharClass, screen.charClass, NULL),
Sres(XtNdecTerminalID, XtCDecTerminalID, screen.term_id, DFT_DECID),
+ Sres(XtNdefaultString, XtCDefaultString, screen.default_string, "#"),
+ Sres(XtNeightBitSelectTypes, XtCEightBitSelectTypes,
+ screen.eightbit_select_types, NULL),
Sres(XtNfont, XtCFont, misc.default_font.f_n, DEFFONT),
Sres(XtNgeometry, XtCGeometry, misc.geo_metry, NULL),
Sres(XtNkeyboardDialect, XtCKeyboardDialect, screen.keyboard_dialect, DFT_KBD_DIALECT),
@@ -669,6 +673,7 @@ static XtResource resources[] =
Ires(XtNutf8, XtCUtf8, screen.utf8_mode, uDefault),
Sres(XtNwideBoldFont, XtCWideBoldFont, misc.default_font.f_wb, DEFWIDEBOLDFONT),
Sres(XtNwideFont, XtCWideFont, misc.default_font.f_w, DEFWIDEFONT),
+ Sres(XtNutf8SelectTypes, XtCUtf8SelectTypes, screen.utf8_select_types, NULL),
#endif
#if OPT_LUIT_PROG
@@ -3731,9 +3736,9 @@ HandleStructNotify(Widget w GCC_UNUSED,
#if OPT_BLINK_CURS
static void
-SetCursorBlink(TScreen * screen, Boolean enable)
+SetCursorBlink(TScreen * screen, Bool enable)
{
- screen->cursor_blink = enable;
+ screen->cursor_blink = (Boolean) enable;
if (DoStartBlinking(screen)) {
StartBlinking(screen);
} else {
@@ -3747,7 +3752,7 @@ SetCursorBlink(TScreen * screen, Boolean enable)
void
ToggleCursorBlink(TScreen * screen)
{
- SetCursorBlink(screen, (Boolean) (!(screen->cursor_blink)));
+ SetCursorBlink(screen, (Bool) (!(screen->cursor_blink)));
}
#endif
@@ -5602,6 +5607,12 @@ VTInitialize(Widget wrequest,
init_Bres(screen.allowTitleOp0);
init_Bres(screen.allowWindowOp0);
+ init_Sres(screen.default_string);
+ init_Sres(screen.eightbit_select_types);
+#if OPT_WIDE_CHARS
+ init_Sres(screen.utf8_select_types);
+#endif
+
/* make a copy so that editres cannot change the resource after startup */
wnew->screen.allowSendEvents = wnew->screen.allowSendEvent0;
wnew->screen.allowFontOps = wnew->screen.allowFontOp0;
diff --git a/app/xterm/input.c b/app/xterm/input.c
index 76e48c4cd..7de33bf6d 100644
--- a/app/xterm/input.c
+++ b/app/xterm/input.c
@@ -1,4 +1,4 @@
-/* $XTermId: input.c,v 1.304 2009/01/26 00:09:29 tom Exp $ */
+/* $XTermId: input.c,v 1.307 2009/03/15 18:53:57 tom Exp $ */
/*
* Copyright 1999-2008,2009 by Thomas E. Dickey
@@ -342,35 +342,23 @@ allowModifierParm(XtermWidget xw, KEY_DATA * kd)
* Meta+Ctrl+Alt+Shift 16 = 1(None)+8(Meta)+1(Shift)+2(Alt)+4(Ctrl)
*/
-#undef CTRL
-
-/* FIXME - make these used in xtermcap.c */
-#define UNMOD 1
-#define SHIFT 1
-#define ALT 2
-#define CTRL 4
-#define META 8
-
-#define MODIFIER_NAME(parm, name) \
- (((parm > UNMOD) && ((parm - UNMOD) & name)) ? " "#name : "")
-
unsigned
xtermParamToState(XtermWidget xw, unsigned param)
{
unsigned result = 0;
#if OPT_NUM_LOCK
- if (param > UNMOD
+ if (param > MOD_NONE
&& ((ShiftMask
| ControlMask
| xw->misc.alt_mods
| xw->misc.meta_mods) & xw->misc.other_mods) == 0) {
- if ((param - UNMOD) & SHIFT)
+ if ((param - MOD_NONE) & MOD_SHIFT)
result |= ShiftMask;
- if ((param - UNMOD) & CTRL)
+ if ((param - MOD_NONE) & MOD_CTRL)
result |= ControlMask;
- if ((param - UNMOD) & ALT)
+ if ((param - MOD_NONE) & MOD_ALT)
result |= xw->misc.alt_mods;
- if ((param - UNMOD) & META)
+ if ((param - MOD_NONE) & MOD_META)
result |= xw->misc.meta_mods;
}
#else
@@ -378,10 +366,10 @@ xtermParamToState(XtermWidget xw, unsigned param)
(void) param;
#endif
TRACE(("xtermParamToState(%d) %s%s%s%s -> %#x\n", param,
- MODIFIER_NAME(param, SHIFT),
- MODIFIER_NAME(param, ALT),
- MODIFIER_NAME(param, CTRL),
- MODIFIER_NAME(param, META),
+ MODIFIER_NAME(param, MOD_SHIFT),
+ MODIFIER_NAME(param, MOD_ALT),
+ MODIFIER_NAME(param, MOD_CTRL),
+ MODIFIER_NAME(param, MOD_META),
result));
return result;
}
@@ -389,36 +377,39 @@ xtermParamToState(XtermWidget xw, unsigned param)
unsigned
xtermStateToParam(XtermWidget xw, unsigned state)
{
- unsigned modify_parm = UNMOD;
+ unsigned modify_parm = MOD_NONE;
+ TRACE(("xtermStateToParam %#x\n", state));
#if OPT_NUM_LOCK
if ((state & xw->misc.other_mods) == 0) {
if (state & ShiftMask) {
- modify_parm += SHIFT;
+ modify_parm += MOD_SHIFT;
state &= ~ShiftMask;
}
if (state & ControlMask) {
- modify_parm += CTRL;
+ modify_parm += MOD_CTRL;
state &= ~ControlMask;
}
if ((state & xw->misc.alt_mods) != 0) {
- modify_parm += ALT;
+ modify_parm += MOD_ALT;
state &= ~xw->misc.alt_mods;
}
if ((state & xw->misc.meta_mods) != 0) {
- modify_parm += META;
+ modify_parm += MOD_META;
state &= ~xw->misc.meta_mods;
}
}
+ if (modify_parm == MOD_NONE)
+ modify_parm = 0;
#else
(void) xw;
(void) state;
#endif
TRACE(("...xtermStateToParam %d%s%s%s%s\n", modify_parm,
- MODIFIER_NAME(modify_parm, SHIFT),
- MODIFIER_NAME(modify_parm, ALT),
- MODIFIER_NAME(modify_parm, CTRL),
- MODIFIER_NAME(modify_parm, META)));
+ MODIFIER_NAME(modify_parm, MOD_SHIFT),
+ MODIFIER_NAME(modify_parm, MOD_ALT),
+ MODIFIER_NAME(modify_parm, MOD_CTRL),
+ MODIFIER_NAME(modify_parm, MOD_META)));
return modify_parm;
}
@@ -572,26 +563,25 @@ ModifyOtherKeys(XtermWidget xw,
break;
#ifdef XK_ISO_Left_Tab
case XK_ISO_Left_Tab:
- if (computeMaskedModifier(xw, state, ShiftMask) > 1)
+ if (computeMaskedModifier(xw, state, ShiftMask))
result = True;
break;
#endif
case XK_Return:
case XK_Tab:
- result = (modify_parm > 1);
+ result = (modify_parm != 0);
break;
default:
if (IsControlInput(kd)) {
if (state == ControlMask || state == ShiftMask) {
result = False;
} else {
- result = (modify_parm > 1);
+ result = (modify_parm != 0);
}
} else if (IsControlAlias(kd)) {
if (state == ShiftMask)
result = False;
- else if (computeMaskedModifier(xw, state, ControlMask)
- > 1) {
+ else if (computeMaskedModifier(xw, state, ControlMask)) {
result = True;
}
} else {
@@ -604,28 +594,28 @@ ModifyOtherKeys(XtermWidget xw,
switch (kd->keysym) {
case XK_BackSpace:
/* strip ControlMask as per IsBackarrowToggle() */
- if (computeMaskedModifier(xw, state, ControlMask) > 1)
+ if (computeMaskedModifier(xw, state, ControlMask))
result = True;
break;
case XK_Delete:
- result = (xtermStateToParam(xw, state) > 1);
+ result = (xtermStateToParam(xw, state) != 0);
break;
#ifdef XK_ISO_Left_Tab
case XK_ISO_Left_Tab:
- if (computeMaskedModifier(xw, state, ShiftMask) > 1)
+ if (computeMaskedModifier(xw, state, ShiftMask))
result = True;
break;
#endif
case XK_Return:
case XK_Tab:
- result = (modify_parm > 1);
+ result = (modify_parm != 0);
break;
default:
if (IsControlInput(kd)) {
result = True;
} else if (state == ShiftMask) {
result = (kd->keysym == ' ' || kd->keysym == XK_Return);
- } else if (computeMaskedModifier(xw, state, ShiftMask) > 1) {
+ } else if (computeMaskedModifier(xw, state, ShiftMask)) {
result = True;
}
break;
@@ -677,7 +667,7 @@ modifyOtherKey(ANSI * reply, int input_char, unsigned modify_parm, int format_ke
static void
modifyCursorKey(ANSI * reply, int modify, unsigned *modify_parm)
{
- if (*modify_parm > 1) {
+ if (*modify_parm != 0) {
if (modify < 0) {
*modify_parm = 0;
}
@@ -763,7 +753,7 @@ TranslateFromSUNPC(KeySym keysym)
#if OPT_MOD_FKEYS
#define MODIFIER_PARM \
- if (modify_parm > 1) APPEND_PARM(modify_parm)
+ if (modify_parm != 0) APPEND_PARM(modify_parm)
#else
#define MODIFIER_PARM /*nothing */
#endif
@@ -1105,7 +1095,7 @@ Input(XtermWidget xw,
&& !ModifyOtherKeys(xw, evt_state, &kd, modify_parm)
#endif
) || (kd.keysym == XK_Delete
- && ((modify_parm > 1)
+ && ((modify_parm != 0)
|| !xtermDeleteIsDEL(xw)))) {
dec_code = decfuncvalue(&kd);
if ((evt_state & ShiftMask)
@@ -1143,7 +1133,7 @@ Input(XtermWidget xw,
reply.a_final = 'Z';
#if OPT_MOD_FKEYS
if (keyboard->modify_now.other_keys > 1
- && computeMaskedModifier(xw, evt_state, ShiftMask) > 1)
+ && computeMaskedModifier(xw, evt_state, ShiftMask))
modifyOtherKey(&reply, '\t', modify_parm, keyboard->format_keys);
#endif
} else
diff --git a/app/xterm/main.h b/app/xterm/main.h
index 3e0cb33f8..83fde3df9 100644
--- a/app/xterm/main.h
+++ b/app/xterm/main.h
@@ -1,4 +1,4 @@
-/* $XTermId: main.h,v 1.39 2009/02/08 18:03:56 tom Exp $ */
+/* $XTermId: main.h,v 1.42 2009/03/28 17:39:51 tom Exp $ */
/*
* Copyright 2000-2008,2009 by Thomas E. Dickey
@@ -91,6 +91,22 @@
#define DEFFACESIZE "14.0"
#endif
+#ifndef DEF_ALLOW_FONT
+#define DEF_ALLOW_FONT True
+#endif
+
+#ifndef DEF_ALLOW_TCAP
+#define DEF_ALLOW_TCAP True
+#endif
+
+#ifndef DEF_ALLOW_TITLE
+#define DEF_ALLOW_TITLE True
+#endif
+
+#ifndef DEF_ALLOW_WINDOW
+#define DEF_ALLOW_WINDOW True
+#endif
+
#if OPT_BLINK_TEXT
#define DEFBLINKASBOLD False
#else
diff --git a/app/xterm/menu.c b/app/xterm/menu.c
index 42c9642af..a7f8ba2a1 100644
--- a/app/xterm/menu.c
+++ b/app/xterm/menu.c
@@ -1,4 +1,4 @@
-/* $XTermId: menu.c,v 1.246 2009/02/13 19:56:04 tom Exp $ */
+/* $XTermId: menu.c,v 1.248 2009/03/28 17:27:57 tom Exp $ */
/*
@@ -1566,59 +1566,59 @@ do_font_utf8_title(Widget gw GCC_UNUSED,
#if OPT_TEK4014
static void
-do_tektextlarge(Widget gw GCC_UNUSED,
+do_tektextlarge(Widget gw,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TekSetFontSize(tekWidget, tekMenu_tektextlarge);
+ TekSetFontSize(getTekWidget(gw), tekMenu_tektextlarge);
}
static void
-do_tektext2(Widget gw GCC_UNUSED,
+do_tektext2(Widget gw,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TekSetFontSize(tekWidget, tekMenu_tektext2);
+ TekSetFontSize(getTekWidget(gw), tekMenu_tektext2);
}
static void
-do_tektext3(Widget gw GCC_UNUSED,
+do_tektext3(Widget gw,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TekSetFontSize(tekWidget, tekMenu_tektext3);
+ TekSetFontSize(getTekWidget(gw), tekMenu_tektext3);
}
static void
-do_tektextsmall(Widget gw GCC_UNUSED,
+do_tektextsmall(Widget gw,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TekSetFontSize(tekWidget, tekMenu_tektextsmall);
+ TekSetFontSize(getTekWidget(gw), tekMenu_tektextsmall);
}
static void
-do_tekpage(Widget gw GCC_UNUSED,
+do_tekpage(Widget gw,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TekSimulatePageButton(tekWidget, False);
+ TekSimulatePageButton(getTekWidget(gw), False);
}
static void
-do_tekreset(Widget gw GCC_UNUSED,
+do_tekreset(Widget gw,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TekSimulatePageButton(tekWidget, True);
+ TekSimulatePageButton(getTekWidget(gw), True);
}
static void
-do_tekcopy(Widget gw GCC_UNUSED,
+do_tekcopy(Widget gw,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TekCopy(tekWidget);
+ TekCopy(getTekWidget(gw));
}
static void
@@ -2504,7 +2504,7 @@ SetupShell(Widget *menus, MenuList * shell, int n, int m)
XtNborderWidth, &button_border,
(XtPointer) 0);
- (void) setMenuLocale(True, saveLocale);
+ (void) setMenuLocale(False, saveLocale);
return (Dimension) (button_height + (button_border * 2));
}
#endif /* OPT_TOOLBAR */
diff --git a/app/xterm/minstall.sh b/app/xterm/minstall.sh
index 158f41c55..918030cb8 100644
--- a/app/xterm/minstall.sh
+++ b/app/xterm/minstall.sh
@@ -1,8 +1,8 @@
#!/bin/sh
-# $XFree86: xc/programs/xterm/minstall.sh,v 1.5 2006/04/10 00:34:37 dickey Exp $
+# $XTermId: minstall.sh,v 1.14 2009/03/15 23:06:08 tom Exp $
#
# Install manpages, substituting a reasonable section value since XFree86 4.x
-# doesn't use constants...
+# and derived imakes do not use constants...
#
# Parameters:
# $1 = program to invoke as "install"
@@ -11,18 +11,43 @@
# $4 = app-defaults directory
#
+# override locale...
+LANG=C; export LANG
+LANGUAGE=C; export LANGUAGE
+LC_ALL=C; export LC_ALL
+LC_CTYPE=C; export LC_CTYPE
+XTERM_LOCALE=C export XTERM_LOCALE
+
+# avoid interference by the "man" command.
+for p in /bin /usr/bin
+do
+if test -f $p/cat ; then
+MANPAGER=cat; export MANPAGER
+PAGER=cat; export PAGER
+break
+fi
+done
+
+# get parameters
MINSTALL="$1"
OLD_FILE="$2"
END_FILE="$3"
APPS_DIR="$4"
-suffix=`echo "$END_FILE" | sed -e 's%^[^.]*.%%'`
+suffix=`echo "$END_FILE" | sed -e 's%^.*\.%%'`
NEW_FILE=temp$$
+MY_MANSECT=$suffix
+
+# "X" is usually in the miscellaneous section, along with "undocumented".
+# Use that to guess an appropriate section.
+X_MANSECT=`man X 2>&1 | tr '\012' '\020' | sed -e 's/^[^0123456789]*\([^) ][^) ]*\).*/\1/'`
+test -z "$X_MANSECT" && X_MANSECT=$suffix
+
sed -e 's%__vendorversion__%"X Window System"%' \
-e s%__apploaddir__%$APPS_DIR% \
- -e s%__mansuffix__%$suffix%g \
- -e s%__miscmansuffix__%$suffix%g \
+ -e s%__mansuffix__%$MY_MANSECT%g \
+ -e s%__miscmansuffix__%$X_MANSECT%g \
$OLD_FILE >$NEW_FILE
echo "$MINSTALL $OLD_FILE $END_FILE"
diff --git a/app/xterm/misc.c b/app/xterm/misc.c
index 6f6580f15..e783cce50 100644
--- a/app/xterm/misc.c
+++ b/app/xterm/misc.c
@@ -1,4 +1,4 @@
-/* $XTermId: misc.c,v 1.405 2009/02/13 23:39:29 tom Exp $ */
+/* $XTermId: misc.c,v 1.410 2009/03/28 17:33:52 tom Exp $ */
/*
*
@@ -821,16 +821,14 @@ AtomBell(XtermWidget xw, int which)
void
xtermBell(XtermWidget xw, int which, int percent)
{
- if (percent > 0) {
- TScreen *screen = TScreenOf(xw);
+ TScreen *screen = TScreenOf(xw);
#if defined(HAVE_XKB_BELL_EXT)
- Atom tony = AtomBell(xw, which);
- if (tony != None) {
- XkbBell(screen->display, VShellWindow, percent, tony);
- } else
+ Atom tony = AtomBell(xw, which);
+ if (tony != None) {
+ XkbBell(screen->display, VShellWindow, percent, tony);
+ } else
#endif
- XBell(screen->display, percent);
- }
+ XBell(screen->display, percent);
}
void
@@ -2900,16 +2898,16 @@ do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen)
char *tmp;
char *parsed = ++cp;
- unparseputc1(xw, ANSI_DCS);
-
code = xtermcapKeycode(xw, &parsed, &state, &fkey);
+ unparseputc1(xw, ANSI_DCS);
+
unparseputc(xw, code >= 0 ? '1' : '0');
unparseputc(xw, '+');
unparseputc(xw, 'r');
- while (*cp != 0) {
+ while (*cp != 0 && (code >= -1)) {
if (cp == parsed)
break; /* no data found, error */
@@ -2927,14 +2925,6 @@ do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen)
unparseputn(xw, NUM_ANSI_COLORS);
} else
#endif
-#if OPT_TCAP_FKEYS
- /*
- * First ensure that we handle the extended cursor- and
- * editing-keypad keys.
- */
- if ((code <= XK_Fn(MAX_FKEY))
- || xtermcapString(xw, CodeToXkey(code), 0) == 0)
-#endif
{
XKeyEvent event;
event.state = state;
@@ -3841,6 +3831,7 @@ xtermEnvLocale(void)
if ((result = x_nonempty(setlocale(LC_CTYPE, 0))) == 0) {
result = "C";
}
+ result = x_strdup(result);
TRACE(("xtermEnvLocale ->%s\n", result));
}
return result;
@@ -3947,6 +3938,6 @@ getXtermWidget(Widget w)
} else {
xw = getXtermWidget(XtParent(w));
}
- TRACE(("getXtermWidget %p -> %p\n", w, xw));
+ TRACE2(("getXtermWidget %p -> %p\n", w, xw));
return xw;
}
diff --git a/app/xterm/ptyx.h b/app/xterm/ptyx.h
index 4580b3a24..22461b3fc 100644
--- a/app/xterm/ptyx.h
+++ b/app/xterm/ptyx.h
@@ -1,4 +1,4 @@
-/* $XTermId: ptyx.h,v 1.542 2009/02/10 23:24:50 tom Exp $ */
+/* $XTermId: ptyx.h,v 1.546 2009/03/24 22:20:06 tom Exp $ */
/*
* Copyright 1999-2008,2009 by Thomas E. Dickey
@@ -1383,7 +1383,7 @@ typedef struct {
Boolean send_focus_pos; /* user wants focus in/out info */
Boolean quiet_grab; /* true if no cursor change on focus */
#if OPT_PASTE64
- int base64_paste; /* set to send paste in base64 */
+ Cardinal base64_paste; /* set to send paste in base64 */
int base64_final; /* string-terminator for paste */
/* _qWriteSelectionData expects these to be initialized to zero.
* base64_flush() is the last step of the conversion, it clears these
@@ -1668,6 +1668,13 @@ typedef struct {
int firstValidRow; /* Valid rows for selection clipping */
int lastValidRow; /* " " */
+ String default_string;
+ String eightbit_select_types;
+ Atom* selection_targets_8bit;
+#if OPT_WIDE_CHARS
+ String utf8_select_types;
+ Atom* selection_targets_utf8;
+#endif
Atom* selection_atoms; /* which selections we own */
Cardinal sel_atoms_size; /* how many atoms allocated */
Cardinal selection_count; /* how many atoms in use */
diff --git a/app/xterm/trace.c b/app/xterm/trace.c
index f77a9dcd6..6e3e5dbfb 100644
--- a/app/xterm/trace.c
+++ b/app/xterm/trace.c
@@ -1,8 +1,8 @@
-/* $XTermId: trace.c,v 1.85 2008/06/03 20:52:34 tom Exp $ */
+/* $XTermId: trace.c,v 1.87 2009/03/23 20:08:03 tom Exp $ */
/************************************************************
-Copyright 1997-2007,2008 by Thomas E. Dickey
+Copyright 1997-2008,2009 by Thomas E. Dickey
All Rights Reserved
@@ -41,6 +41,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <stdarg.h>
#include <assert.h>
+#include <X11/Xatom.h>
+#include <X11/Xmu/Atoms.h>
+
#ifdef HAVE_X11_TRANSLATEI_H
#include <X11/TranslateI.h>
#else
@@ -297,6 +300,26 @@ visibleEventType(int type)
}
const char *
+visibleSelectionTarget(Display * d, Atom a)
+{
+ const char *result = "?";
+
+ if (a == XA_STRING) {
+ result = "XA_STRING";
+ } else if (a == XA_TEXT(d)) {
+ result = "XA_TEXT()";
+ } else if (a == XA_COMPOUND_TEXT(d)) {
+ result = "XA_COMPOUND_TEXT()";
+ } else if (a == XA_UTF8_STRING(d)) {
+ result = "XA_UTF8_STRING()";
+ } else if (a == XA_TARGETS(d)) {
+ result = "XA_TARGETS()";
+ }
+
+ return result;
+}
+
+const char *
visibleXError(int code)
{
static char temp[80];
diff --git a/app/xterm/trace.h b/app/xterm/trace.h
index 9f2c3b9cd..f841624d1 100644
--- a/app/xterm/trace.h
+++ b/app/xterm/trace.h
@@ -1,8 +1,8 @@
-/* $XTermId: trace.h,v 1.44 2008/07/27 15:21:20 tom Exp $ */
+/* $XTermId: trace.h,v 1.45 2009/03/19 23:47:59 tom Exp $ */
/************************************************************
-Copyright 1997-2007,2008 by Thomas E. Dickey
+Copyright 1997-2008,2009 by Thomas E. Dickey
All Rights Reserved
@@ -40,6 +40,7 @@ extern void Trace ( const char *, ... )
__attribute__ ((format(printf,1,2)))
#endif
;
+#undef TRACE
#define TRACE(p) Trace p
#if OPT_TRACE > 1
@@ -50,33 +51,43 @@ extern const char * visibleChrsetName(int /* chrset */);
extern char * visibleChars (PAIRED_CHARS(Char * /* buf */, Char * /* buf2 */), unsigned /* len */);
extern char * visibleIChar (IChar *, unsigned);
extern const char * visibleEventType (int);
+extern const char * visibleSelectionTarget(Display * /* d */, Atom /* a */);
extern const char * visibleXError (int /* code */);
extern void TraceArgv(const char * /* tag */, char ** /* argv */);
+#undef TRACE_ARGV
#define TRACE_ARGV(tag,argv) TraceArgv(tag,argv)
extern char *trace_who;
+#undef TRACE_CHILD
#define TRACE_CHILD int tracing_child = (trace_who = "child") != 0; (void) tracing_child;
extern void TraceSizeHints(XSizeHints *);
+#undef TRACE_HINTS
#define TRACE_HINTS(hints) TraceSizeHints(hints)
extern void TraceIds(const char * /* fname */, int /* lnum */);
+#undef TRACE_IDS
#define TRACE_IDS TraceIds(__FILE__, __LINE__)
extern void TraceOptions(OptionHelp * /* options */, XrmOptionDescRec * /* resources */, Cardinal /* count */);
+#undef TRACE_OPTS
#define TRACE_OPTS(opts,ress,lens) TraceOptions(opts,ress,lens)
extern void TraceTranslations(const char *, Widget);
+#undef TRACE_TRANS
#define TRACE_TRANS(name,w) TraceTranslations(name,w)
extern void TraceWMSizeHints(XtermWidget);
+#undef TRACE_WM_HINTS
#define TRACE_WM_HINTS(w) TraceWMSizeHints(w)
extern void TraceXtermResources(void);
+#undef TRACE_XRES
#define TRACE_XRES() TraceXtermResources()
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)
diff --git a/app/xterm/util.c b/app/xterm/util.c
index 32cf4311e..b8cf5b746 100644
--- a/app/xterm/util.c
+++ b/app/xterm/util.c
@@ -1,4 +1,4 @@
-/* $XTermId: util.c,v 1.420 2009/02/13 23:38:26 tom Exp $ */
+/* $XTermId: util.c,v 1.421 2009/03/16 00:37:25 tom Exp $ */
/*
* Copyright 1999-2008,2009 by Thomas E. Dickey
@@ -3104,9 +3104,9 @@ drawXtermText(XtermWidget xw,
&& text2[src] == 0
&& (text[src] == ANSI_DEL ||
text[src] < ANSI_SPA)) {
- int ni = dec2ucs((unsigned) ((text[src] == ANSI_DEL)
- ? 0
- : text[src]));
+ unsigned ni = dec2ucs((unsigned) ((text[src] == ANSI_DEL)
+ ? 0
+ : text[src]));
UCS2SBUF(ni);
}
#endif /* OPT_MINI_LUIT */
diff --git a/app/xterm/version.h b/app/xterm/version.h
index 1a815e639..4d009ec65 100644
--- a/app/xterm/version.h
+++ b/app/xterm/version.h
@@ -1,4 +1,4 @@
-/* $XTermId: version.h,v 1.298 2009/02/08 01:58:12 tom Exp $ */
+/* $XTermId: version.h,v 1.299 2009/02/28 15:56:11 tom Exp $ */
/*
* These definitions are used to build the string that's printed in response to
@@ -6,7 +6,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 242
+#define XTERM_PATCH 243
#ifndef __vendorversion__
#define __vendorversion__ "XTerm/OpenBSD"
diff --git a/app/xterm/xterm.h b/app/xterm/xterm.h
index ec006317d..79aa6beed 100644
--- a/app/xterm/xterm.h
+++ b/app/xterm/xterm.h
@@ -1,4 +1,4 @@
-/* $XTermId: xterm.h,v 1.520 2009/02/13 23:39:20 tom Exp $ */
+/* $XTermId: xterm.h,v 1.523 2009/03/28 14:56:54 tom Exp $ */
/************************************************************
@@ -383,11 +383,13 @@ extern char **environ;
#define XtNcutNewline "cutNewline"
#define XtNcutToBeginningOfLine "cutToBeginningOfLine"
#define XtNdecTerminalID "decTerminalID"
+#define XtNdefaultString "defaultString"
#define XtNdeleteIsDEL "deleteIsDEL"
#define XtNdynamicColors "dynamicColors"
#define XtNeightBitControl "eightBitControl"
#define XtNeightBitInput "eightBitInput"
#define XtNeightBitOutput "eightBitOutput"
+#define XtNeightBitSelectTypes "eightBitSelectTypes"
#define XtNfaceName "faceName"
#define XtNfaceNameDoublesize "faceNameDoublesize"
#define XtNfaceSize "faceSize"
@@ -412,7 +414,7 @@ extern char **environ;
#define XtNi18nSelections "i18nSelections"
#define XtNinitialFont "initialFont"
#define XtNinternalBorder "internalBorder"
-#define XtNitalicULMode "italicULMode"
+#define XtNitalicULMode "italicULMode"
#define XtNjumpScroll "jumpScroll"
#define XtNkeepSelection "keepSelection"
#define XtNkeyboardDialect "keyboardDialect"
@@ -424,7 +426,7 @@ extern char **environ;
#define XtNlogging "logging"
#define XtNloginShell "loginShell"
#define XtNmarginBell "marginBell"
-#define XtNmaximized "maximized"
+#define XtNmaximized "maximized"
#define XtNmenuBar "menuBar"
#define XtNmenuHeight "menuHeight"
#define XtNmetaSendsEscape "metaSendsEscape"
@@ -481,6 +483,7 @@ extern char **environ;
#define XtNuseClipping "useClipping"
#define XtNutf8 "utf8"
#define XtNutf8Latin1 "utf8Latin1"
+#define XtNutf8SelectTypes "utf8SelectTypes"
#define XtNutf8Title "utf8Title"
#define XtNveryBoldColors "veryBoldColors"
#define XtNvisualBell "visualBell"
@@ -524,7 +527,7 @@ extern char **environ;
#define XtCCacheDoublesize "CacheDoublesize"
#define XtCCharClass "CharClass"
#define XtCCjkWidth "CjkWidth"
-#define XtCColorAttrMode "ColorAttrMode"
+#define XtCColorAttrMode "ColorAttrMode"
#define XtCColorMode "ColorMode"
#define XtCColumn "Column"
#define XtCCombiningChars "CombiningChars"
@@ -537,11 +540,13 @@ extern char **environ;
#define XtCCutNewline "CutNewline"
#define XtCCutToBeginningOfLine "CutToBeginningOfLine"
#define XtCDecTerminalID "DecTerminalID"
+#define XtCDefaultString "DefaultString"
#define XtCDeleteIsDEL "DeleteIsDEL"
#define XtCDynamicColors "DynamicColors"
#define XtCEightBitControl "EightBitControl"
#define XtCEightBitInput "EightBitInput"
#define XtCEightBitOutput "EightBitOutput"
+#define XtCEightBitSelectTypes "EightBitSelectTypes"
#define XtCFaceName "FaceName"
#define XtCFaceNameDoublesize "FaceNameDoublesize"
#define XtCFaceSize "FaceSize"
@@ -574,7 +579,7 @@ extern char **environ;
#define XtCLogging "Logging"
#define XtCLoginShell "LoginShell"
#define XtCMarginBell "MarginBell"
-#define XtCMaximized "Maximized"
+#define XtCMaximized "Maximized"
#define XtCMenuBar "MenuBar"
#define XtCMenuHeight "MenuHeight"
#define XtCMetaSendsEscape "MetaSendsEscape"
@@ -625,6 +630,7 @@ extern char **environ;
#define XtCUseClipping "UseClipping"
#define XtCUtf8 "Utf8"
#define XtCUtf8Latin1 "Utf8Latin1"
+#define XtCUtf8SelectTypes "Utf8SelectTypes"
#define XtCUtf8Title "Utf8Title"
#define XtCVT100Graphics "VT100Graphics"
#define XtCVeryBoldColors "VeryBoldColors"
@@ -666,6 +672,7 @@ struct XTERM_RESOURCE;
/* Tekproc.c */
#if OPT_TEK4014
+extern TekWidget getTekWidget(Widget /* w */);
extern int TekGetFontSize (const char * /* param */);
extern int TekInit (void);
extern int TekPtyData(void);
diff --git a/app/xterm/xterm.log.html b/app/xterm/xterm.log.html
index b4fff7a5f..4b8e008ac 100644
--- a/app/xterm/xterm.log.html
+++ b/app/xterm/xterm.log.html
@@ -20,7 +20,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF *
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
*****************************************************************************
- $XTermId: xterm.log.html,v 1.731 2009/02/16 00:26:07 tom Exp $
+ $XTermId: xterm.log.html,v 1.744 2009/03/29 00:29:55 tom Exp $
-->
<HTML>
<HEAD>
@@ -45,6 +45,7 @@ Most of these are summarized in the XFree86 CHANGELOG
is the latest version of this file.
<UL>
+<LI><A HREF="#xterm_243">Patch #243 - 2009/3/28</A>
<LI><A HREF="#xterm_242">Patch #242 - 2009/2/15</A>
<LI><A HREF="#xterm_241">Patch #241 - 2009/1/26</A>
<LI><A HREF="#xterm_240">Patch #240 - 2009/1/25</A>
@@ -290,6 +291,57 @@ is the latest version of this file.
<LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A>
</UL>
+<H1><A NAME="xterm_243">Patch #243 - 2009/3/28</A></H1>
+<ul>
+ <li>revert change to default for <code>allowTcapOps</code> (request by
+ Bram Moolenaar).
+
+ <li>reallocate result returned by <code>xtermEnvLocale()</code> to
+ avoid reference to freed memory after handling
+ <code>menuLocale</code> resource.
+
+ <li>fix an old (X11R5) bug in tek4014 for switching fontsizes.
+
+ <li>add resource <code>defaultString</code> to make configurable the
+ use of "#" when pastes of UTF-8 text fail due to limitations in
+ the current locale settings.
+
+ <li>make the set of selection target Atom's configurable by two new
+ resources <code>eightBitSelectTypes</code> and
+ <code>utf8SelectTypes</code>, e.g., to use the <code>TEXT</code>
+ Atom in preference to <code>UTF8_STRING</code> (discussion with
+ Stanislav Sedov regarding koi8rxterm and the FreeBSD port).
+
+ <li>modify handling of <code>TARGETS</code> Atom by making it return
+ exactly the set of targets as those which xterm is currently
+ providing.
+
+ <li>set <code>MANPAGER</code> and <code>PAGER</code> explicitly to
+ /bin/cat in <code>minstall.sh</code> to work around /etc/man.conf's
+ with those variables already set
+ (report by &#1052;&#1072;&#1088;&#1100;&#1103;&#1089;&#1080;&#1085;
+ &#1057;&#1077;&#1084;&#1105;&#1085;).
+ <li>improve error-checking of tcap-query parser.
+
+ <li>add check for keyboard <code>tcap</code>), which ensures that
+ terminal descriptions containing the same string for
+ shifted/unshifted keys will be seen by tcap-query as only the
+ unshifted key. (This would only happen with an incorrect terminal
+ description).
+
+ <li>fix conversion for input event-state to modifier-parameter which
+ made tcap-query feature not work with <code>tcapFunctionKeys</code>
+ (keyboard type <code>tcap</code>).
+
+ <li>add "DEF_ALLOW_<em>XXX</em>" definitions to main.h to allow
+ overriding the default compiled-in values for
+ "allow<em>xxx</em>" resources.
+
+ <li>remove check on bell-percentage added in
+ <a href="#xterm_242">patch #242</a>,
+ which disallowed zero/negative values (Redhat Bugzilla #487829).
+</ul>
+
<H1><A NAME="xterm_242">Patch #242 - 2009/2/15</A></H1>
<ul>
<li>fix configure check for <code>XkbBell</code> and provide
diff --git a/app/xterm/xterm.man b/app/xterm/xterm.man
index 7f71f967b..6aaea1457 100644
--- a/app/xterm/xterm.man
+++ b/app/xterm/xterm.man
@@ -1,5 +1,5 @@
'\" t
-.\" $XTermId: xterm.man,v 1.420 2009/02/11 00:11:56 tom Exp $
+.\" $XTermId: xterm.man,v 1.423 2009/03/25 22:39:57 tom Exp $
.\"
.\" Copyright 1996-2008,2009 by Thomas E. Dickey
.\"
@@ -496,7 +496,7 @@ This option specifies the font to be used for displaying wide text.
By default,
it will attempt to use a font twice as wide as the font that will be used to
draw normal text.
-If no doublewidth font is found, it will improvise, by stretching
+If no double-width font is found, it will improvise, by stretching
the normal font.
This corresponds to the \fBwideFont\fP resource.
.TP 8
@@ -505,7 +505,7 @@ This option specifies the font to be used for displaying bold wide text.
By default,
it will attempt to use a font twice as wide as the font that will be used to
draw bold text.
-If no doublewidth font is found, it will improvise, by stretching
+If no double-width font is found, it will improvise, by stretching
the bold font.
This corresponds to the \fBwideBoldFont\fP resource.
.TP 8
@@ -1686,6 +1686,9 @@ Depending on your configuration, the font server may have its own configuration
file.
The same ":unscaled" can be added to its configuration file at the
end of the directory specification for "misc".
+.IP
+The bitmap scaling feature is also used by \fIxterm\fP to implement
+VT102 double-width and double-height characters.
.TP 8
.B "brokenLinuxOSC (\fPclass\fB BrokenLinuxOSC)"
If true, \fIxterm\fP applies a workaround to ignore malformed control
@@ -1719,7 +1722,7 @@ The default is ``false.''
.TP 8
.B "cacheDoublesize (\fPclass\fB CacheDoublesize)"
Tells whether to cache double-sized fonts by \fIxterm\fR.
-Set this to zero to disable doublesize fonts altogether.
+Set this to zero to disable double-sized fonts altogether.
.TP 8
.B "charClass (\fPclass\fB CharClass)"
Specifies comma-separated lists of character class bindings of the form
@@ -1937,6 +1940,19 @@ the type of response to a DA control sequence.
Leading non-digit characters are ignored, e.g., "vt100" and "100" are the same.
The default is 100.
.TP 8
+.B "defaultString (\fPclass\fB DefaultString)"
+Specify the character (or string) which \fIxterm\fP will substitute when
+pasted text includes a character which cannot be represented in the
+current encoding.
+For instance, pasting UTF-8 text into a display of ISO-8859-1 characters
+will only be able to display codes 0-255, while UTF-8 text can include
+Unicode values above 255.
+The default is ``#'' (a single pound sign).
+.IP
+If the undisplayable text would be double-width,
+\fIxterm\fP will add a space after the ``#'' character, to give roughly
+the same layout on the screen as the original text.
+.TP 8
.B "deleteIsDEL (\fPclass\fB DeleteIsDEL)"
Specifies whether the Delete key on the editing keypad should send DEL (127)
or the VT220-style Remove escape sequence.
@@ -1995,6 +2011,11 @@ accepted as is or stripped when printed.
The default is ``true,''
which means that they are accepted as is.
.TP 8
+.B "eightBitSelectTypes (\fPclass\fB EightBitSelectTypes\fP)"
+Override \fIxterm\fP's default selection target list (see SELECT/PASTE) for
+selections in normal (ISO-8859-1) mode.
+The default is an empty string, which does not override anything.
+.TP 8
.B "faceName (\fPclass\fB FaceName)"
Specify the pattern for fonts selected from the FreeType
library if support for that library was compiled into \fIxterm\fR.
@@ -2094,11 +2115,11 @@ Specifies the name of the sixth alternative font.
.TP 8
.B "fontDoublesize (\fPclass\fB FontDoublesize)"
Specifies whether \fIxterm\fP should attempt to use font scaling to draw
-doublesize characters.
+double-sized characters.
Some older font servers cannot do this properly, will return misleading
font metrics.
The default is ``true''.
-If disabled, \fIxterm\fP will simulate doublesize characters by drawing
+If disabled, \fIxterm\fP will simulate double-sized characters by drawing
normal characters with spaces between them.
.TP 8
.B "fontWarnings (\fPclass\fB FontWarnings)"
@@ -2275,7 +2296,7 @@ lower left corner of the screen.
The default is ``false.''
.TP 8
.B "i18nSelections (\fPclass\fB I18nSelections)"
-If false, \fIxterm\fP will never request the targets
+If false, \fIxterm\fP will not request the targets
.B COMPOUND_TEXT
or
.BR TEXT .
@@ -2937,6 +2958,11 @@ font to be combined with an ISO-10646 font if the latter is given
via the \fB-fw\fP option or its corresponding resource value.
The default is ``false.''
.TP 8
+.B "utf8SelectTypes (\fPclass\fB Utf8SelectTypes)"
+Override \fIxterm\fP's default selection target list (see SELECT/PASTE) for
+selections in wide-character (UTF-8) mode.
+The default is an empty string, which does not override anything.
+.TP 8
.B "utf8Title (\fPclass\fB Utf8Title)"
Applications can set \fIxterm\fP's title by writing a control sequence.
Normally this control sequence follows the VT220 convention,
@@ -2989,7 +3015,7 @@ This option specifies the font to be used for displaying bold wide text.
By default,
it will attempt to use a font twice as wide as the font that will be used to
draw bold text.
-If no doublewidth font is found, it will improvise, by stretching
+If no double-width font is found, it will improvise, by stretching
the bold font.
.TP 8
.B "wideChars (\fPclass\fB WideChars)"
@@ -3002,7 +3028,7 @@ This option specifies the font to be used for displaying wide text.
By default,
it will attempt to use a font twice as wide as the font that will be used to
draw normal text.
-If no doublewidth font is found, it will improvise, by stretching
+If no double-width font is found, it will improvise, by stretching
the normal font.
.TP 8
.B "ximFont (\fPclass\fB XimFont)"
@@ -3437,6 +3463,89 @@ see
for details).
.
.
+.SH SELECT/PASTE
+X clients provide select and paste support by responding to requests conveyed
+by the server.
+.SS PRIMARY
+When configured to use the primary selection,
+(the default) \fIxterm\fP can
+provide the selection data in ways which help to retain character
+encoding information as it is pasted.
+.PP
+A user "selects" text on xterm, which highlights the selected text.
+A subsequent "paste" to another client forwards a request to the client owning
+the selection.
+If \fIxterm\fP owns the primary selection, it makes the data
+available in the form of one or more "selection targets".
+If it does not own the primary selection,
+e.g., if it has released it or another client has
+asserted ownership, it relies on cut-buffers to pass the data.
+But cut-buffers handle only ISO-8859-1 data
+(officially \- some clients ignore the rules).
+.
+.SS CLIPBOARD
+When configured to use the clipboard (see resource \fBselectToClipboard\fP),
+the problem with persistence of ownership is bypassed.
+Otherwise, there is no difference regarding the data which can be
+passed via selection.
+.
+.SS SELECTION TARGETS
+The different types of data which are passed depend on what the receiving
+client asks for.
+These are termed \fIselection targets\fP.
+.PP
+When asking for the selection data,
+\fIxterm\fP tries the following types in this order:
+.RS
+.TP 5
+UTF8_STRING
+This is an XFree86 extension, which denotes that the data is encoded in UTF-8.
+When \fIxterm\fP is built with wide-character support,
+it both accepts and provides this type.
+.TP 5
+TEXT
+the text is in the encoding which corresponds to your current locale.
+.TP 5
+.\" see xc/doc/specs/CTEXT/ctext.tbl.ms
+.\" (it says the data is stored as a type of ISO 2022)
+COMPOUND_TEXT
+this is a format for multiple character set data, such as multi-lingual text.
+It can store UTF-8 data as a special case.
+.TP 5
+STRING
+This is Latin 1 (ISO-8859-1) data.
+.RE
+.PP
+The middle two (TEXT and COMPOUND_TEXT) are added if \fIxterm\fP
+is configured with the \fBi18nSelections\fP resource set to ``true''.
+.PP
+UTF8_STRING is preferred (therefore first in the list)
+since \fIxterm\fP stores text as Unicode data when
+running in wide-character mode, and no translation is needed.
+On the other hand, TEXT and COMPOUND_TEXT may require translation.
+If the translation is incomplete, they will insert X's ``defaultString''
+whose value cannot be set, and may simply be empty.
+\fIXterm\fP's \fBdefaultString\fP resource specifies the string to
+use for incomplete translations of the UTF8_STRING.
+.PP
+You can alter the types which \fIxterm\fP tries using the
+\fBeightBitSelectTypes\fP or \fButf8SelectTypes\fP resources.
+For instance, you might have some specific locale setting
+which does not use UTF-8 encoding.
+The resource value is a comma-separated list of the selection targets,
+which consist of the names shown. You can use the special name I18N
+to denote the optional inclusion of TEXT and COMPOUND_TEXT.
+The names are matched ignoring case, and can be abbreviated.
+The default list can be expressed in several ways, e.g.,
+.sp
+.RS
+.nf
+UTF8_STRING,I18N,STRING
+utf8,i18n,string
+u,i,s
+.fi
+.RE
+.
.SH MENUS
.
.PP
diff --git a/app/xterm/xtermcap.c b/app/xterm/xtermcap.c
index 501c869c1..1fc3d1585 100644
--- a/app/xterm/xtermcap.c
+++ b/app/xterm/xtermcap.c
@@ -1,4 +1,4 @@
-/* $XTermId: xtermcap.c,v 1.15 2009/01/26 00:10:15 tom Exp $ */
+/* $XTermId: xtermcap.c,v 1.21 2009/03/16 00:31:06 tom Exp $ */
/*
* Copyright 2007-2008,2009 by Thomas E. Dickey
@@ -56,37 +56,41 @@
#if OPT_TCAP_QUERY || OPT_TCAP_FKEYS
+#define SHIFT (MOD_NONE + MOD_SHIFT)
+
+#define NO_STRING (char *)(-1)
+
typedef struct {
char *tc;
char *ti;
int code;
- unsigned state;
+ unsigned param; /* see xtermStateToParam() */
} TCAPINFO;
/* *INDENT-OFF* */
#define DATA(tc,ti,x,y) { tc, ti, x, y }
static TCAPINFO table[] = {
- /* tcap terminfo code param */
+ /* tcap terminfo code state */
DATA( "%1", "khlp", XK_Help, 0 ),
- DATA( "#1", "kHLP", XK_Help, 2 ),
+ DATA( "#1", "kHLP", XK_Help, SHIFT ),
DATA( "@0", "kfnd", XK_Find, 0 ),
- DATA( "*0", "kFND", XK_Find, 2 ),
+ DATA( "*0", "kFND", XK_Find, SHIFT ),
DATA( "*6", "kslt", XK_Select, 0 ),
- DATA( "#6", "kSLT", XK_Select, 2 ),
+ DATA( "#6", "kSLT", XK_Select, SHIFT ),
DATA( "kh", "khome", XK_Home, 0 ),
- DATA( "#2", "kHOM", XK_Home, 2 ),
+ DATA( "#2", "kHOM", XK_Home, SHIFT ),
DATA( "@7", "kend", XK_End, 0 ),
- DATA( "*7", "kEND", XK_End, 2 ),
+ DATA( "*7", "kEND", XK_End, SHIFT ),
DATA( "kl", "kcub1", XK_Left, 0 ),
DATA( "kr", "kcuf1", XK_Right, 0 ),
DATA( "ku", "kcuu1", XK_Up, 0 ),
DATA( "kd", "kcud1", XK_Down, 0 ),
- DATA( "#4", "kLFT", XK_Left, 2 ),
- DATA( "%i", "kRIT", XK_Right, 2 ),
- DATA( "%e", "kPRV", XK_Up, 2 ),
- DATA( "%c", "kNXT", XK_Down, 2 ),
+ DATA( "#4", "kLFT", XK_Left, SHIFT ),
+ DATA( "%i", "kRIT", XK_Right, SHIFT ),
+ DATA( "%e", "kPRV", XK_Up, SHIFT ),
+ DATA( "%c", "kNXT", XK_Down, SHIFT ),
DATA( "k1", "kf1", XK_Fn(1), 0 ),
DATA( "k2", "kf2", XK_Fn(2), 0 ),
@@ -202,6 +206,37 @@ static TCAPINFO table[] = {
#undef DATA
/* *INDENT-ON* */
+#if OPT_TCAP_FKEYS
+static void
+loadTermcapStrings(TScreen * screen)
+{
+ if (screen->tcap_fkeys == 0) {
+ Cardinal want = XtNumber(table);
+ Cardinal have;
+ char *fkey;
+
+#if !(USE_TERMINFO && defined(HAVE_TIGETSTR))
+ char *area = screen->tcap_area;
+#endif
+
+ if ((screen->tcap_fkeys = TypeCallocN(char *, want)) != 0) {
+ for (have = 0; have < want; ++have) {
+#if USE_TERMINFO && defined(HAVE_TIGETSTR)
+ fkey = tigetstr(table[have].ti);
+#else
+ fkey = tgetstr(table[have].tc, &area);
+#endif
+ if (fkey != 0 && fkey != NO_STRING) {
+ screen->tcap_fkeys[have] = x_strdup(fkey);
+ } else {
+ screen->tcap_fkeys[have] = NO_STRING;
+ }
+ }
+ }
+ }
+}
+#endif
+
#if OPT_TCAP_QUERY
static int
hex2int(int c)
@@ -215,35 +250,84 @@ hex2int(int c)
return -1;
}
-static TCAPINFO *
-lookupTcapByName(XtermWidget xw, const char *name)
+static Boolean
+keyIsDistinct(XtermWidget xw, int which)
{
- TCAPINFO *result = 0;
- Cardinal n;
+ Boolean result = True;
- if (name != 0 && *name != '\0') {
- for (n = 0; n < XtNumber(table); n++) {
- if (!strcmp(table[n].ti, name) || !strcmp(table[n].tc, name)) {
- result = table + n;
- break;
+ switch (xw->keyboard.type) {
+ case keyboardIsTermcap:
+#if OPT_TCAP_FKEYS
+ if (table[which].param == SHIFT) {
+ TScreen *screen = TScreenOf(xw);
+ Cardinal k;
+ char *fkey;
+
+ loadTermcapStrings(screen);
+ if ((fkey = screen->tcap_fkeys[which]) != NO_STRING) {
+ for (k = 0; k < XtNumber(table); k++) {
+ if (table[k].code == table[which].code
+ && table[k].param == 0) {
+ if ((fkey = screen->tcap_fkeys[k]) != NO_STRING
+ && !strcmp(fkey, screen->tcap_fkeys[which])) {
+ TRACE(("shifted/unshifted keys do not differ\n"));
+ result = False;
+ }
+ break;
+ }
+ }
+ } else {
+ /* there is no data for the shifted key */
+ result = -1;
}
}
+#endif
+ break;
+ /*
+ * The vt220-keyboard will not return distinct key sequences for
+ * shifted cursor-keys. Just pretend they do not exist, since some
+ * programs may be confused if we return the same data for
+ * shifted/unshifted keys.
+ */
+ case keyboardIsVT220:
+ if (table[which].param == SHIFT) {
+ TRACE(("shifted/unshifted keys do not differ\n"));
+ result = False;
+ }
+ break;
+ case keyboardIsLegacy:
+ case keyboardIsDefault:
+ case keyboardIsHP:
+ case keyboardIsSCO:
+ case keyboardIsSun:
+ break;
}
- /*
- * The vt220-keyboard will not return distinct key sequences for shifted
- * cursor-keys. Just pretend they do not exist, since some programs may
- * be confused if we return the same data for shifted/unshifted keys.
- */
- if (xw->keyboard.type == keyboardIsVT220
- && result != 0
- && result->state == 2) {
- result = 0;
+ return result;
+}
+
+static int
+lookupTcapByName(const char *name)
+{
+ int result = -2;
+ Cardinal j;
+
+ if (name != 0 && *name != '\0') {
+ for (j = 0; j < XtNumber(table); j++) {
+ if (!strcmp(table[j].ti, name) || !strcmp(table[j].tc, name)) {
+ result = (int) j;
+ break;
+ }
+ }
}
- if (result != 0) {
- TRACE(("lookupTcapByName(%s) tc=%s, ti=%s code %#x, state %#x\n",
- name, result->tc, result->ti, result->code, result->state));
+ if (result >= 0) {
+ TRACE(("lookupTcapByName(%s) tc=%s, ti=%s code %#x, param %#x\n",
+ name,
+ table[result].tc,
+ table[result].ti,
+ table[result].code,
+ table[result].param));
} else {
TRACE(("lookupTcapByName(%s) FAIL\n", name));
}
@@ -264,6 +348,7 @@ xtermcapKeycode(XtermWidget xw, char **params, unsigned *state, Bool * fkey)
{
TCAPINFO *data;
unsigned len = 0;
+ int which;
int code = -1;
#define MAX_TNAME_LEN 6
char name[MAX_TNAME_LEN + 1];
@@ -283,40 +368,52 @@ xtermcapKeycode(XtermWidget xw, char **params, unsigned *state, Bool * fkey)
*state = 0;
*fkey = False;
- if (*p == 0 || *p == ';') {
- if ((data = lookupTcapByName(xw, name)) != 0) {
- code = data->code;
- *state = xtermParamToState(xw, data->state);
- if (IsFunctionKey(code)) {
- *fkey = True;
- } else if (code < 0) {
- *fkey = True;
- code = XK_Fn((-code));
- }
+ if (len && (*p == 0 || *p == ';')) {
+ if ((which = lookupTcapByName(name)) >= 0) {
+ if (keyIsDistinct(xw, which)) {
+ data = table + which;
+ code = data->code;
+ *state = xtermParamToState(xw, data->param);
+ if (IsFunctionKey(code)) {
+ *fkey = True;
+ } else if (code < 0) {
+ *fkey = True;
+ code = XK_Fn((-code));
+ }
#if OPT_SUN_FUNC_KEYS
- if (*fkey && xw->keyboard.type == keyboardIsSun) {
- int num = code - XK_Fn(0);
-
- /* match function-key case in sunfuncvalue() */
- if (num > 20) {
- if (num <= 30 || num > 47) {
- code = -1;
- } else {
- code -= 10;
- switch (num) {
- case 37: /* khome */
- case 39: /* kpp */
- case 41: /* kb2 */
- case 43: /* kend */
- case 45: /* knp */
+ if (*fkey && xw->keyboard.type == keyboardIsSun) {
+ int num = code - XK_Fn(0);
+
+ /* match function-key case in sunfuncvalue() */
+ if (num > 20) {
+ if (num <= 30 || num > 47) {
code = -1;
- break;
+ } else {
+ code -= 10;
+ switch (num) {
+ case 37: /* khome */
+ case 39: /* kpp */
+ case 41: /* kb2 */
+ case 43: /* kend */
+ case 45: /* knp */
+ code = -1;
+ break;
+ }
}
}
}
- }
#endif
+ } else {
+ TRACE(("... name ok, data not ok\n"));
+ code = -1;
+ }
+ } else {
+ TRACE(("... name not ok\n"));
+ code = -2;
}
+ } else {
+ TRACE(("... name not ok\n"));
+ code = -2;
}
TRACE(("... xtermcapKeycode(%s, %u, %d) -> %#06x\n",
@@ -327,16 +424,16 @@ xtermcapKeycode(XtermWidget xw, char **params, unsigned *state, Bool * fkey)
#if OPT_TCAP_FKEYS
static TCAPINFO *
-lookupTcapByCode(int code, unsigned mask)
+lookupTcapByCode(int code, unsigned param)
{
TCAPINFO *result = 0;
Cardinal n;
- TRACE(("lookupTcapByCode %d:%#x\n", code, mask));
+ TRACE(("lookupTcapByCode %#x:%#x\n", code, param));
for (n = 0; n < XtNumber(table); n++) {
if (table[n].code == code &&
- table[n].state == mask) {
- TRACE(("lookupTcapByCode %d:%s\n", n, table[n].ti));
+ table[n].param == param) {
+ TRACE(("->lookupTcapByCode %d:%s\n", n, table[n].ti));
result = table + n;
break;
}
@@ -344,8 +441,6 @@ lookupTcapByCode(int code, unsigned mask)
return result;
}
-#define NO_STRING (char *)(-1)
-
int
xtermcapString(XtermWidget xw, int keycode, unsigned mask)
{
@@ -355,31 +450,10 @@ xtermcapString(XtermWidget xw, int keycode, unsigned mask)
if ((data = lookupTcapByCode(keycode, param)) != 0) {
TScreen *screen = TScreenOf(xw);
- Cardinal which = data - table;
+ Cardinal which = (Cardinal) (data - table);
char *fkey;
- if (screen->tcap_fkeys == 0) {
- Cardinal want = XtNumber(table);
- Cardinal have;
-#if !(USE_TERMINFO && defined(HAVE_TIGETSTR))
- char *area = screen->tcap_area;
-#endif
-
- if ((screen->tcap_fkeys = TypeCallocN(char *, want)) != 0) {
- for (have = 0; have < want; ++have) {
-#if USE_TERMINFO && defined(HAVE_TIGETSTR)
- fkey = tigetstr(table[have].ti);
-#else
- fkey = tgetstr(table[have].tc, &area);
-#endif
- if (fkey != 0 && fkey != NO_STRING) {
- screen->tcap_fkeys[have] = x_strdup(fkey);
- } else {
- screen->tcap_fkeys[have] = NO_STRING;
- }
- }
- }
- }
+ loadTermcapStrings(screen);
if (screen->tcap_fkeys != 0) {
if ((fkey = screen->tcap_fkeys[which]) != NO_STRING) {
StringInput(xw, (Char *) fkey, strlen(fkey));
diff --git a/app/xterm/xtermcap.h b/app/xterm/xtermcap.h
index fbd5bc06a..b7829083c 100644
--- a/app/xterm/xtermcap.h
+++ b/app/xterm/xtermcap.h
@@ -1,8 +1,8 @@
-/* $XTermId: xtermcap.h,v 1.3 2007/03/18 23:37:48 tom Exp $ */
+/* $XTermId: xtermcap.h,v 1.7 2009/03/15 18:18:11 tom Exp $ */
/************************************************************
-Copyright 2007 by Thomas E. Dickey
+Copyright 2007,2009 by Thomas E. Dickey
All Rights Reserved
@@ -68,6 +68,15 @@ authorization.
extern "C" {
#endif
+#define MOD_NONE 1
+#define MOD_SHIFT 1
+#define MOD_ALT 2
+#define MOD_CTRL 4
+#define MOD_META 8
+
+#define MODIFIER_NAME(parm, name) \
+ (((parm > MOD_NONE) && ((parm - MOD_NONE) & name)) ? " "#name : "")
+
/* xtermcap.c */
extern Bool get_termcap(char * /* name */, char * /* buffer */);