# ftp://ftp.invisible-island.net/xterm/patches/xterm-353.patch.gz
# patch by Thomas E. Dickey <dickey@invisible-island.net>
# created  Sun Feb  2 02:05:46 UTC 2020
# ------------------------------------------------------------------------------
# MANIFEST                  |    2 
# aclocal.m4                |    6 -
# charclass.h               |    4 
# charproc.c                |   12 +-
# charsets.c                |    6 -
# ctlseqs.ms                |   27 ++++--
# ctlseqs.txt               |   36 +++++---
# fontutils.c               |  185 ++++++++++++++++++++++++++++----------------
# graphics_regis.c          |   19 ++--
# graphics_sixel.c          |    6 -
# main.c                    |    6 -
# misc.c                    |   12 ++
# package/debian/changelog  |    6 +
# package/freebsd/Makefile  |    6 -
# package/pkgsrc/Makefile   |    2 
# package/xterm.spec        |    4 
# print.c                   |    6 -
# run-tic.sh                |   34 ++++++--
# terminfo                  |    6 -
# trace.c                   |   56 ++++++++++++-
# trace.h                   |    5 -
# version.h                 |    6 -
# vms.c                     |   12 +-
# vttests/modify-keys.pl    |    6 -
# vttests/print-vt-chars.pl |    6 -
# xterm.appdata.xml         |    2 
# xterm.h                   |    4 
# xterm.log.html            |   52 ++++++++++--
# xterm_io.h                |    4 
# 29 files changed, 365 insertions(+), 173 deletions(-)
# ------------------------------------------------------------------------------
Index: MANIFEST
--- xterm-352+/MANIFEST	2019-11-18 09:22:56.000000000 +0000
+++ xterm-353/MANIFEST	2020-01-18 15:53:11.000000000 +0000
@@ -1,4 +1,4 @@
-MANIFEST for xterm-352, version xterm-352
+MANIFEST for xterm-353, version xterm-353
 --------------------------------------------------------------------------------
 MANIFEST                        this file
 256colres.h                     resource-definitions for 256-color mode
Index: aclocal.m4
--- xterm-352+/aclocal.m4	2020-01-16 10:23:46.000000000 +0000
+++ xterm-353/aclocal.m4	2020-01-18 17:30:44.000000000 +0000
@@ -1,4 +1,4 @@
-dnl $XTermId: aclocal.m4,v 1.446 2020/01/16 10:23:46 tom Exp $
+dnl $XTermId: aclocal.m4,v 1.447 2020/01/18 17:30:44 tom Exp $
 dnl
 dnl ---------------------------------------------------------------------------
 dnl
@@ -2456,9 +2456,9 @@
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_SIG_ATOMIC_T version: 3 updated: 2012/10/04 20:12:20
+dnl CF_SIG_ATOMIC_T version: 4 updated: 2020/01/18 12:30:44
 dnl ---------------
-dnl signal handler, but there are some gcc depedencies in that recommendation.
+dnl signal handler, but there are some gcc dependencies in that recommendation.
 dnl Try anyway.
 AC_DEFUN([CF_SIG_ATOMIC_T],
 [
Index: charclass.h
--- xterm-352+/charclass.h	2017-05-29 14:57:26.000000000 +0000
+++ xterm-353/charclass.h	2020-01-18 18:29:41.000000000 +0000
@@ -1,4 +1,4 @@
-/* $XTermId: charclass.h,v 1.7 2017/05/29 14:57:26 tom Exp $ */
+/* $XTermId: charclass.h,v 1.8 2020/01/18 18:29:41 tom Exp $ */
 
 /* $XFree86: xc/programs/xterm/charclass.h,v 1.3 2006/02/13 01:14:58 dickey Exp $ */
 
@@ -6,7 +6,7 @@
 #define CHARCLASS_H
 
 extern void init_classtab(void);
-/* intialise the table. needs calling before either of the 
+/* initialise the table. needs calling before either of the 
    others. */
 
 extern int SetCharacterClassRange(int low, int high, int value);
Index: charproc.c
--- xterm-352+/charproc.c	2020-01-11 00:28:15.000000000 +0000
+++ xterm-353/charproc.c	2020-01-29 19:19:42.000000000 +0000
@@ -1,4 +1,4 @@
-/* $XTermId: charproc.c,v 1.1738 2020/01/11 00:28:15 tom Exp $ */
+/* $XTermId: charproc.c,v 1.1740 2020/01/29 19:19:42 tom Exp $ */
 
 /*
  * Copyright 1999-2019,2020 by Thomas E. Dickey
@@ -1093,7 +1093,7 @@
     /* This implements the IBM PC-style convention of 8-colors, with one
      * bit for bold, thus mapping the 0-7 codes to 8-15.  It won't make
      * much sense for 16-color applications, but we keep it to retain
-     * compatiblity with ANSI-color applications.
+     * compatibility with ANSI-color applications.
      */
 #if OPT_PC_COLORS		/* XXXJTL should be settable at runtime (resource or OSC?) */
     if (TScreenOf(xw)->boldColors
@@ -5821,6 +5821,10 @@
     case UnmapNotify:
 	mapstate = IsUnmapped;
 	break;
+    case MappingNotify:
+	XRefreshKeyboardMapping(&(event->xmapping));
+	VTInitModifiers(xw);
+	break;
     case ConfigureNotify:
 	if (event->xconfigure.window == XtWindow(toplevel)) {
 #if !OPT_TOOLBAR
@@ -6042,7 +6046,7 @@
 		 * mode.  xterm saves/restores/initializes the most commonly
 		 * used settings, but a real VT100 or VT520 may differ.
 		 *
-		 * For instance, DEC's documention goes on to comment that
+		 * For instance, DEC's documentation goes on to comment that
 		 * while the VT52 uses hardware tabs (8 columns), the emulation
 		 * (e.g., a VT420) does not alter those tab settings when
 		 * switching modes.
@@ -9801,7 +9805,7 @@
     wnew->VT100_TB_INFO(menu_bar) = request->VT100_TB_INFO(menu_bar);
     init_Ires(VT100_TB_INFO(menu_height));
 #endif
-    XtAddEventHandler(my_parent, StructureNotifyMask, False,
+    XtAddEventHandler(my_parent, MappingNotify | StructureNotifyMask, False,
 		      HandleStructNotify, (Opaque) 0);
 #endif /* HANDLE_STRUCT_NOTIFY */
 
Index: charsets.c
--- xterm-352+/charsets.c	2019-02-11 00:41:13.000000000 +0000
+++ xterm-353/charsets.c	2020-01-18 18:51:57.000000000 +0000
@@ -1,7 +1,7 @@
-/* $XTermId: charsets.c,v 1.105 2019/02/11 00:41:13 tom Exp $ */
+/* $XTermId: charsets.c,v 1.107 2020/01/18 18:51:57 tom Exp $ */
 
 /*
- * Copyright 1998-2018,2019 by Thomas E. Dickey
+ * Copyright 1998-2019,2020 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -1492,7 +1492,7 @@
 	count++;
 #if OPT_WIDE_CHARS
 	/*
-	 * This is only partly right - prevent inadvertant remapping of
+	 * This is only partly right - prevent inadvertent remapping of
 	 * the replacement character and other non-8bit codes into bogus
 	 * 8bit codes.
 	 */
Index: ctlseqs.ms
--- xterm-352+/ctlseqs.ms	2019-11-02 14:26:14.000000000 +0000
+++ xterm-353/ctlseqs.ms	2020-01-26 22:05:26.000000000 +0000
@@ -1,9 +1,9 @@
 .\"#! troff -ms $1		-*- Nroff -*-
 .\" "Xterm Control Sequences" document
-.\" $XTermId: ctlseqs.ms,v 1.561 2019/11/02 14:26:14 tom Exp $
+.\" $XTermId: ctlseqs.ms,v 1.565 2020/01/26 22:05:26 tom Exp $
 .\"
 .\"
-.\" Copyright 1996-2018,2019 by Thomas E. Dickey
+.\" Copyright 1996-2019,2020 by Thomas E. Dickey
 .\"
 .\"                         All Rights Reserved
 .\"
@@ -69,8 +69,8 @@
 .\"
 .ds XT XTerm
 .ds xt xterm
-.ds LF Patch #350
-.ds RF 2019/11/02
+.ds LF Patch #353
+.ds RF 2020/01/26
 .\"
 .if n .pl 9999v		\" no page breaks in nroff
 .ND
@@ -346,7 +346,7 @@
 Thomas Dickey
 .AI
 XFree86 Project (1996-2006)
-invisible-island.net (2006-2019)
+invisible-island.net (2006-2020)
 updated for \*(XT \*(LF (\*(RF)
 .AU
 .
@@ -2081,7 +2081,7 @@
 Filter rectangles are always treated as \*(``one-shot\*('' events.
 Any parameters that are omitted default to the current locator position.
 If all parameters are omitted, any locator motion will be reported.
-DECELR always cancels any prevous rectangle definition.
+DECELR always cancels any previous rectangle definition.
 .
 .iP
 .IP \\*(Cs\\*(Ps\\*s\\*x
@@ -3135,11 +3135,14 @@
 as buttons 1 and 2 respectively,
 except that 64 is added to the event code.
 Release events for the wheel buttons are not reported.
+.LP
 By default,
-the wheel mouse events are translated to \fIscroll-back\fP
-and \fIscroll-forw\fP actions.
+the wheel mouse events (buttons 4 and 5)
+are translated to \fIscroll-back\fP
+and \fIscroll-forw\fP actions, respectively.
 Those actions normally scroll the whole window,
 as if the scrollbar was used.
+.LP
 However if \fIAlternate Scroll\fP mode is set,
 then cursor up/down controls are sent when the terminal is displaying
 the \fIAlternate Screen Buffer\fP.
@@ -3147,6 +3150,9 @@
 using the \fBalternateScroll\fP resource.
 .Ss Other buttons
 .LP
+Some wheel mice can send additional button events,
+e.g., by tilting the scroll wheel left and right.
+.LP
 Additional buttons are encoded like the wheel mice,
 .bP
 by adding 64 (for buttons 6 and 7), or
@@ -3155,9 +3161,12 @@
 .LP
 Past button 11, the encoding is ambiguous because the same code
 may correspond to different button/modifier combinations.
+.LP
 It is not possible to use these buttons (6-11) in \fI\*(xt\fP's
 \fBtranslations\fP resource because their names are not in the X Toolkit's
 symbol table.
+However, applications can check for the reports, e.g.,
+button 7 (left) and button 6 (right) with a Logitech mouse.
 .Ss Highlight tracking
 .LP
 Mouse highlight tracking notifies a program of a button press, receives a
@@ -3323,7 +3332,7 @@
 while the highlight tracking \*(Cs\*T can be mistaken for SD (scroll down),
 and the Window manipulation controls.
 For these reasons, the 1015 control is not recommended;
-it is not an improvement over 1005.
+it is not an improvement over 1006.
 .
 .Sh "Sixel Graphics"
 .LP
Index: ctlseqs.txt
--- xterm-352+/ctlseqs.txt	2019-11-02 14:26:16.000000000 +0000
+++ xterm-353/ctlseqs.txt	2020-01-26 22:11:38.000000000 +0000
@@ -20,8 +20,8 @@
 
                              Thomas Dickey
                       XFree86 Project (1996-2006)
-                    invisible-island.net (2006-2019)
-               updated for XTerm Patch #350 (2019/11/02)
+                    invisible-island.net (2006-2020)
+               updated for XTerm Patch #353 (2020/01/26)
 
 
 
@@ -1424,7 +1424,7 @@
           as "one-shot" events.  Any parameters that are omitted default
           to the current locator position.  If all parameters are omit-
           ted, any locator motion will be reported.  DECELR always can-
-          cels any prevous rectangle definition.
+          cels any previous rectangle definition.
 
 CSI Ps x  Request Terminal Parameters (DECREQTPARM).
           if Ps is a "0" (default) or "1", and xterm is emulating VT100,
@@ -2307,16 +2307,23 @@
 Wheel mice may return buttons 4 and 5.  Those buttons are represented by
 the same event codes as buttons 1 and 2 respectively, except that 64 is
 added to the event code.  Release events for the wheel buttons are not
-reported.  By default, the wheel mouse events are translated to scroll-
-back and scroll-forw actions.  Those actions normally scroll the whole
-window, as if the scrollbar was used.  However if Alternate Scroll mode
-is set, then cursor up/down controls are sent when the terminal is dis-
-playing the Alternate Screen Buffer.  The initial state of Alternate
-Scroll mode is set using the alternateScroll resource.
+reported.
+
+By default, the wheel mouse events (buttons 4 and 5) are translated to
+scroll-back and scroll-forw actions, respectively.  Those actions nor-
+mally scroll the whole window, as if the scrollbar was used.
+
+However if Alternate Scroll mode is set, then cursor up/down controls
+are sent when the terminal is displaying the Alternate Screen Buffer.
+The initial state of Alternate Scroll mode is set using the alternate-
+Scroll resource.
 
 
 Other buttons
 
+Some wheel mice can send additional button events, e.g., by tilting the
+scroll wheel left and right.
+
 Additional buttons are encoded like the wheel mice,
 
 o   by adding 64 (for buttons 6 and 7), or
@@ -2324,9 +2331,12 @@
 o   by adding 128 (for buttons 8 through 11).
 
 Past button 11, the encoding is ambiguous because the same code may cor-
-respond to different button/modifier combinations.  It is not possible
-to use these buttons (6-11) in xterm's translations resource because
-their names are not in the X Toolkit's symbol table.
+respond to different button/modifier combinations.
+
+It is not possible to use these buttons (6-11) in xterm's translations
+resource because their names are not in the X Toolkit's symbol table.
+However, applications can check for the reports, e.g., button 7 (left)
+and button 6 (right) with a Logitech mouse.
 
 
 Highlight tracking
@@ -2484,7 +2494,7 @@
           the highlight tracking CSI T  can be mistaken for SD (scroll
           down), and the Window manipulation controls.  For these rea-
           sons, the 1015 control is not recommended; it is not an
-          improvement over 1005.
+          improvement over 1006.
 
 
 Sixel Graphics
Index: fontutils.c
--- xterm-352+/fontutils.c	2020-01-16 00:20:50.000000000 +0000
+++ xterm-353/fontutils.c	2020-01-29 19:54:47.000000000 +0000
@@ -1,4 +1,4 @@
-/* $XTermId: fontutils.c,v 1.665 2020/01/16 00:20:50 tom Exp $ */
+/* $XTermId: fontutils.c,v 1.671 2020/01/29 19:54:47 tom Exp $ */
 
 /*
  * Copyright 1998-2019,2020 by Thomas E. Dickey
@@ -122,6 +122,32 @@
     char *end;
 } FontNameProperties;
 
+#if OPT_WIDE_CHARS && (OPT_RENDERFONT || (OPT_TRACE > 1))
+#define MY_UCS(code,high,wide,name) { code, high, wide, #name }
+static const struct {
+    unsigned code, high, wide;
+    const char *name;
+} unicode_boxes[] = {
+
+    MY_UCS(0x2500, 0, 1, box drawings light horizontal),
+	MY_UCS(0x2502, 1, 0, box drawings light vertical),
+	MY_UCS(0x250c, 2, 2, box drawings light down and right),
+	MY_UCS(0x2510, 2, 2, box drawings light down and left),
+	MY_UCS(0x2514, 2, 2, box drawings light up and right),
+	MY_UCS(0x2518, 2, 2, box drawings light up and left),
+	MY_UCS(0x251c, 1, 2, box drawings light vertical and right),
+	MY_UCS(0x2524, 1, 2, box drawings light vertical and left),
+	MY_UCS(0x252c, 2, 1, box drawings light down and horizontal),
+	MY_UCS(0x2534, 2, 1, box drawings light up and horizontal),
+	MY_UCS(0x253c, 1, 1, box drawings light vertical and horizontal),
+    {
+	0, 0, 0, NULL
+    }
+};
+
+#undef MY_UCS
+#endif /* OPT_WIDE_CHARS */
+
 #if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS
 static Boolean merge_sublist(char ***, char **);
 #endif
@@ -2285,7 +2311,7 @@
 #if OPT_RENDERFONT
 
 #define CACHE_XFT(dst,src) if (src.font != 0) {\
-	    int err = checkXft(xw, &(dst[fontnum]), &src);\
+	    int err = checkXftWidth(xw, &(dst[fontnum]), &src);\
 	    TRACE(("Xft metrics %s[%d] = %d (%d,%d)%s advance %d, actual %d%s%s\n",\
 		#dst,\
 		fontnum,\
@@ -2419,23 +2445,98 @@
 }
 #endif
 
+#if OPT_BOX_CHARS
+static void
+setBrokenBoxChars(XtermWidget xw, Bool state)
+{
+    TRACE(("setBrokenBoxChars %s\n", BtoS(state)));
+    term->work.broken_box_chars = (Boolean) state;
+    TScreenOf(xw)->broken_box_chars = (Boolean) state;
+    update_font_boxchars();
+}
+
+#else
+#define setBrokenBoxChars(xw, state)	/* nothing */
+#endif
+
+static Boolean
+checkedXftWidth(Display *dpy,
+		XTermXftFonts *source,
+		unsigned limit,
+		Dimension *width,
+		FcChar32 c)
+{
+    Boolean result = False;
+
+    if (FcCharSetHasChar(source->font->charset, c)) {
+	XGlyphInfo extents;
+
+	result = True;
+	XftTextExtents32(dpy, source->font, &c, 1, &extents);
+	if (*width < extents.width && extents.width <= limit) {
+	    *width = extents.width;
+	}
+    }
+    return result;
+}
+
 static int
-checkXft(XtermWidget xw, XTermXftFonts *target, XTermXftFonts *source)
+checkXftWidth(XtermWidget xw, XTermXftFonts *target, XTermXftFonts *source)
 {
-    TScreen *screen = TScreenOf(xw);
     FcChar32 c;
     FcChar32 last = xtermXftLastChar(source->font);
-    FcChar32 limit = 255;
+    Dimension limit = (Dimension) source->font->max_advance_width;
     Dimension width = 0;
+    Dimension width2 = 0;
     int failed = 0;
-
-    (void) screen;
-    if_OPT_WIDE_CHARS(screen, limit = Min(last, 0x3000));
+#if OPT_WIDE_CHARS
+    Cardinal n;
+#endif
 
     target->font = source->font;
     target->pattern = source->pattern;
     target->map.min_width = 0;
-    target->map.max_width = (Dimension) source->font->max_advance_width;
+    target->map.max_width = limit;
+
+#if OPT_WIDE_CHARS
+    /*
+     * Check if the line-drawing characters are all provided in the font.
+     * If so, take that into account for the cell-widths.
+     */
+    for (n = 0; n < XtNumber(unicode_boxes) - 1; ++n) {
+	if (!checkedXftWidth(XtDisplay(xw),
+			     source,
+			     limit,
+			     &width2, unicode_boxes[n].code)) {
+	    width2 = 0;
+	    TRACE(("font omits U+%04X line-drawing symbol\n",
+		   unicode_boxes[n].code));
+	    break;
+	}
+    }
+#else
+    (void) width2;
+#endif
+
+    if (width2 > 0) {
+	Dimension check = (Dimension) (limit + 1) / 2;
+	TRACE(("font provides VT100-style line-drawing\n"));
+	/*
+	 * The "VT100 line-drawing" characters happen to be all "ambiguous
+	 * width" in Unicode's scheme.  That means that they could be twice as
+	 * wide as the Latin-1 characters.
+	 */
+#define FC_ERR(n) (1.2 * (n))
+	if (width2 > FC_ERR(check)) {
+	    TRACE(("line-drawing characters appear to be double-width (ignore)\n"));
+	    setBrokenBoxChars(xw, True);
+	} else if (width2 > width) {
+	    width = width2;
+	}
+    } else {
+	TRACE(("font does NOT provide VT100-style line-drawing\n"));
+	setBrokenBoxChars(xw, True);
+    }
 
     /*
      * For each printable code, ask what its width is.  Given the maximum width
@@ -2443,28 +2544,17 @@
      *
      * Ignore control characters - their extent information is misleading.
      */
-    for (c = 32; c < limit; ++c) {
-	if (c >= 127 && c <= 159)
+    for (c = 32; c < 255; ++c) {
+	if (CharWidth(c) <= 0)
 	    continue;
 	if (FcCharSetHasChar(source->font->charset, c)) {
-	    XGlyphInfo extents;
-
-	    XftTextExtents32(XtDisplay(xw), source->font, &c, 1, &extents);
-	    if (width >= extents.width)
-		continue;
-	    if (extents.width >= (3 * target->map.max_width)) {
-		width = 0;	/* metrics are bogus - give up */
-		break;
-	    }
-	    if (extents.width > target->map.max_width)
-		continue;
-	    width = extents.width;
-	    if (width >= target->map.max_width) {
-		width = target->map.max_width;
-		break;
-	    }
+	    (void) checkedXftWidth(XtDisplay(xw),
+				   source,
+				   target->map.max_width,
+				   &width, c);
 	}
     }
+
     /*
      * Sometimes someone uses a symbol font which has no useful ASCII or
      * Latin-1 characters.  Allow that, in case they did it intentionally.
@@ -2656,32 +2746,6 @@
 }
 #endif
 
-#if OPT_WIDE_CHARS
-#define MY_UCS(code,high,wide,name) { code, high, wide, #name }
-static const struct {
-    unsigned code, high, wide;
-    const char *name;
-} unicode_boxes[] = {
-
-    MY_UCS(0x2500, 0, 1, box drawings light horizontal),
-	MY_UCS(0x2502, 1, 0, box drawings light vertical),
-	MY_UCS(0x250c, 2, 2, box drawings light down and right),
-	MY_UCS(0x2510, 2, 2, box drawings light down and left),
-	MY_UCS(0x2514, 2, 2, box drawings light up and right),
-	MY_UCS(0x2518, 2, 2, box drawings light up and left),
-	MY_UCS(0x251c, 1, 2, box drawings light vertical and right),
-	MY_UCS(0x2524, 1, 2, box drawings light vertical and left),
-	MY_UCS(0x252c, 2, 1, box drawings light down and horizontal),
-	MY_UCS(0x2534, 2, 1, box drawings light up and horizontal),
-	MY_UCS(0x253c, 1, 1, box drawings light vertical and horizontal),
-    {
-	0, 0, 0, NULL
-    }
-};
-
-#undef MY_UCS
-#endif /* OPT_WIDE_CHARS */
-
 #ifdef DEBUG_XFT
 static void
 trace_xft_glyph(TScreen *screen, XftFont *font, FT_Face face, int code, const char *name)
@@ -2711,20 +2775,7 @@
 #else
 #define trace_xft_line_drawing(screen, font, face)	/* nothing */
 #endif
-#endif
-
-#if OPT_BOX_CHARS
-static void
-setBrokenBoxChars(XtermWidget xw, Bool state)
-{
-    term->work.broken_box_chars = (Boolean) state;
-    TScreenOf(xw)->broken_box_chars = (Boolean) state;
-    update_font_boxchars();
-}
-
-#else
-#define setBrokenBoxChars(xw, state)	/* nothing */
-#endif
+#endif /* DEBUG_XFT */
 
 /*
  * Check if the line-drawing characters do not fill the bounding box.  If so,
Index: graphics_regis.c
--- xterm-352+/graphics_regis.c	2019-11-13 23:24:03.000000000 +0000
+++ xterm-353/graphics_regis.c	2020-01-18 18:38:40.000000000 +0000
@@ -1,7 +1,7 @@
-/* $XTermId: graphics_regis.c,v 1.113 2019/11/13 23:24:03 tom Exp $ */
+/* $XTermId: graphics_regis.c,v 1.114 2020/01/18 18:38:40 tom Exp $ */
 
 /*
- * Copyright 2014-2018,2019 by Ross Combs
+ * Copyright 2014-2019,2020 by Ross Combs
  *
  *                         All Rights Reserved
  *
@@ -882,7 +882,8 @@
 }
 
 /*
- * The plot* functions are based on optimized rasterization primitves written by Zingl Alois.
+ * The plot* functions are based on optimized rasterization primitives written
+ * by Zingl Alois.
  * See http://members.chello.at/easyfilter/bresenham.html
  */
 
@@ -1540,7 +1541,7 @@
     /*
      * FIXME: cache:
      * - the bitmap for the last M characters and target dimensions
-     * - resuse the pixmap object where possible
+     * - reuse the pixmap object where possible
      */
     XftColor bg, fg;
     Pixmap bitmap;
@@ -1974,7 +1975,7 @@
      */
     /*
      * FIXME: cache:
-     * - resuse the font where possible
+     * - reuse the font where possible
      */
 #ifdef XRENDERFONT
     XtermWidget xw = context->destination_graphic->xw;
@@ -4679,7 +4680,7 @@
 	 * (M(=)  # macrograph storage (free bytes of total bytes)
 	 * (P)  # absolute output cursor position
 	 * (P(I))  # interactive locator mode (in one-shot or multiple mode)
-	 * (P(I[xmul,ymul]))  # interactive locator mode with arrow key movement multiplers
+	 * (P(I[xmul,ymul]))  # interactive locator mode with arrow key movement multipliers
 	 */
 	TRACE(("found ReGIS command \"%c\" (report status)\n", ch));
 	state->command = 'r';
@@ -4689,7 +4690,7 @@
 	/* Screen
 
 	 * S
-	 * (A[<upper left>][<lower right>])  # adjust screen cordinates
+	 * (A[<upper left>][<lower right>])  # adjust screen coordinates
 	 * (C<setting>  # 0 (cursor output off), 1 (cursor output on)
 	 * (E)  # erase to background color, resets shades, curves, and stacks
 	 * (F)  # print the graphic and erase the screen (DECprint extension)
@@ -5575,14 +5576,14 @@
 			if (suboption == 'i' || suboption == 'I') {
 			    output = 0;		/* input location report */
 			} else {
-			    TRACE(("DATA_ERROR: unknown ReGIS postion report suboption '%c'\n",
+			    TRACE(("DATA_ERROR: unknown ReGIS position report suboption '%c'\n",
 				   suboption));
 			    break;
 			}
 
 			skip_regis_whitespace(&suboptionarg);
 			if (!fragment_consumed(&optionarg)) {
-			    TRACE(("DATA_ERROR: unexpected content in ReGIS postion report suboptions: \"%s\"\n",
+			    TRACE(("DATA_ERROR: unexpected content in ReGIS position report suboptions: \"%s\"\n",
 				   fragment_to_tempstr(&suboptionarg)));
 			    break;
 			}
Index: graphics_sixel.c
--- xterm-352+/graphics_sixel.c	2016-06-05 20:04:01.000000000 +0000
+++ xterm-353/graphics_sixel.c	2020-01-18 18:38:25.000000000 +0000
@@ -1,7 +1,7 @@
-/* $XTermId: graphics_sixel.c,v 1.18 2016/06/05 20:04:01 tom Exp $ */
+/* $XTermId: graphics_sixel.c,v 1.19 2020/01/18 18:38:25 tom Exp $ */
 
 /*
- * Copyright 2014,2016 by Ross Combs
+ * Copyright 2014-2016,2020 by Ross Combs
  *
  *                         All Rights Reserved
  *
@@ -540,7 +540,7 @@
 	    Pregister = color_params.a_param[0];
 	    if (Pregister >= (int) graphic->valid_registers) {
 		TRACE(("DATA_WARNING: sixel color operator uses out-of-range register %d\n", Pregister));
-		/* FIXME: supposedly the DEC terminals wrapped register indicies -- verify */
+		/* FIXME: supposedly the DEC terminals wrapped register indices -- verify */
 		while (Pregister >= (int) graphic->valid_registers)
 		    Pregister -= (int) graphic->valid_registers;
 		TRACE(("DATA_WARNING: converted to %d\n", Pregister));
Index: main.c
--- xterm-352+/main.c	2019-11-20 09:21:54.000000000 +0000
+++ xterm-353/main.c	2020-01-18 18:38:40.000000000 +0000
@@ -1,7 +1,7 @@
-/* $XTermId: main.c,v 1.860 2019/11/20 09:21:54 tom Exp $ */
+/* $XTermId: main.c,v 1.861 2020/01/18 18:38:40 tom Exp $ */
 
 /*
- * Copyright 2002-2018,2019 by Thomas E. Dickey
+ * Copyright 2002-2019,2020 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -3158,7 +3158,7 @@
     "x11term",			/* for people who want special term name */
 #endif
     DFT_TERMTYPE,		/* for people who want special term name */
-    "xterm",			/* the prefered name, should be fastest */
+    "xterm",			/* the preferred name, should be fastest */
     "vt102",
     "vt100",
     "ansi",
Index: misc.c
--- xterm-352+/misc.c	2020-01-11 01:47:52.000000000 +0000
+++ xterm-353/misc.c	2020-02-01 13:19:03.000000000 +0000
@@ -1,4 +1,4 @@
-/* $XTermId: misc.c,v 1.923 2020/01/11 01:47:52 tom Exp $ */
+/* $XTermId: misc.c,v 1.926 2020/02/01 13:19:03 Jimmy.Aguilar.Mena Exp $ */
 
 /*
  * Copyright 1999-2019,2020 by Thomas E. Dickey
@@ -586,7 +586,6 @@
 	} else if (event.xany.type == MotionNotify
 		   && event.xcrossing.window == XtWindow(xw)) {
 	    switch (screen->send_mouse_pos) {
-	    case BTN_EVENT_MOUSE:
 	    case ANY_EVENT_MOUSE:
 #if OPT_DEC_LOCATOR
 	    case DEC_LOCATOR:
@@ -594,6 +593,9 @@
 		SendMousePosition(xw, &event);
 		xtermShowPointer(xw, True);
 		continue;
+	    case BTN_EVENT_MOUSE:
+		SendMousePosition(xw, &event);
+		xtermShowPointer(xw, True);
 	    }
 	}
 
@@ -635,6 +637,10 @@
 	     (event.xany.type != ButtonPress) &&
 	     (event.xany.type != ButtonRelease))) {
 
+	    if (event.xany.type == MappingNotify) {
+		XRefreshKeyboardMapping(&(event.xmapping));
+		VTInitModifiers(xw);
+	    }
 	    XtDispatchEvent(&event);
 	}
     } while (xtermAppPending() & XtIMXEvent);
@@ -5779,7 +5785,7 @@
     char *tmpName;
 
     if (pOld) {
-	/* change text cursor, if necesary */
+	/* change text cursor, if necessary */
 	if (pOld->colors[TEXT_CURSOR] == pOld->colors[TEXT_FG]) {
 	    pOld->colors[TEXT_CURSOR] = pOld->colors[TEXT_BG];
 	    if (pOld->names[TEXT_CURSOR]) {
Index: package/debian/changelog
--- xterm-352+/package/debian/changelog	2019-11-18 09:22:56.000000000 +0000
+++ xterm-353/package/debian/changelog	2020-01-18 15:53:11.000000000 +0000
@@ -1,3 +1,9 @@
+xterm-dev (353) unstable; urgency=low
+
+  * maintenance updates
+
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 18 Jan 2020 10:53:11 -0500
+
 xterm-dev (352) unstable; urgency=low
 
   * maintenance updates
Index: package/freebsd/Makefile
--- xterm-352+/package/freebsd/Makefile	2019-11-18 09:22:56.000000000 +0000
+++ xterm-353/package/freebsd/Makefile	2020-01-18 18:35:26.000000000 +0000
@@ -1,4 +1,4 @@
-# $XTermId: Makefile,v 1.72 2019/11/18 09:22:56 tom Exp $
+# $XTermId: Makefile,v 1.73 2020/01/18 15:53:11 tom Exp $
 # $FreeBSD: head/x11/xterm/Makefile 492827 2019-02-13 06:43:36Z ehaupt $
 
 # This is adapted from the FreeBSD port, installing as "xterm-dev" with
@@ -7,7 +7,7 @@
 # and "make makesum".
 
 PORTNAME=	xterm
-PORTVERSION=	352
+PORTVERSION=	353
 CATEGORIES=	x11
 MASTER_SITES=	ftp://ftp.invisible-island.net/xterm/:src1 \
 		https://invisible-mirror.net/archives/xterm/:src1
@@ -43,7 +43,7 @@
 
 DABBREV_DESC=	Enable support for dabbrev-expand
 DECTERM_DESC=	Enable DECterm Locator support
-LUIT_DESC=	Use LUIT for locale convertion from/to UTF-8
+LUIT_DESC=	Use LUIT for locale conversion from/to UTF-8
 SIXEL_DESC=	Enable Sixel graphics support
 REGIS_DESC=	Enable ReGIS graphics support
 WCHAR_DESC=	Enable wide-character support
Index: package/pkgsrc/Makefile
--- xterm-352+/package/pkgsrc/Makefile	2019-11-18 09:22:56.000000000 +0000
+++ xterm-353/package/pkgsrc/Makefile	2020-01-18 15:53:11.000000000 +0000
@@ -1,6 +1,6 @@
 # $NetBSD: Makefile,v 1.117 2018/03/12 11:18:00 wiz Exp $
 
-DISTNAME=	xterm-352
+DISTNAME=	xterm-353
 PKGREVISION=	1
 CATEGORIES=	x11
 MASTER_SITES=	ftp://ftp.invisible-island.net/xterm/
Index: package/xterm.spec
--- xterm-352+/package/xterm.spec	2019-11-18 09:22:56.000000000 +0000
+++ xterm-353/package/xterm.spec	2020-01-18 15:53:11.000000000 +0000
@@ -1,11 +1,11 @@
-# $XTermId: xterm.spec,v 1.124 2019/11/18 09:22:56 tom Exp $
+# $XTermId: xterm.spec,v 1.125 2020/01/18 15:53:11 tom Exp $
 Summary: X terminal emulator (development version)
 %global my_middle xterm
 %global my_suffix -dev
 %global fullname %{my_middle}%{my_suffix}
 %global my_class XTermDev
 Name: %{fullname}
-Version: 352
+Version: 353
 Release: 1
 License: X11
 Group: User Interface/X
Index: print.c
--- xterm-352+/print.c	2017-12-19 23:47:15.000000000 +0000
+++ xterm-353/print.c	2020-01-18 18:50:09.000000000 +0000
@@ -1,7 +1,7 @@
-/* $XTermId: print.c,v 1.166 2017/12/19 23:47:15 tom Exp $ */
+/* $XTermId: print.c,v 1.167 2020/01/18 18:50:09 tom Exp $ */
 
 /*
- * Copyright 1997-2016,2017 by Thomas E. Dickey
+ * Copyright 1997-2017,2020 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -417,7 +417,7 @@
 	     * This implementation only knows how to write to a file.  When the
 	     * file is closed the print command executes.  Print command must
 	     * be of the form:
-	     *   print/que=name/delete [/otherflags].
+	     *   print/queue=name/delete [/otherflags].
 	     */
 	    SPS.fp = fopen(VMS_TEMP_PRINT_FILE, "w");
 #else
Index: run-tic.sh
--- xterm-352+/run-tic.sh	2019-05-12 00:44:47.000000000 +0000
+++ xterm-353/run-tic.sh	2020-01-18 16:27:34.000000000 +0000
@@ -1,9 +1,9 @@
 #!/bin/sh
-# $XTermId: run-tic.sh,v 1.11 2019/05/12 00:44:47 tom Exp $
+# $XTermId: run-tic.sh,v 1.12 2020/01/18 16:27:34 tom Exp $
 # -----------------------------------------------------------------------------
 # this file is part of xterm
 #
-# Copyright 2006-2007,2019 by Thomas E. Dickey
+# Copyright 2006-2019,2020 by Thomas E. Dickey
 # 
 #                         All Rights Reserved
 # 
@@ -36,6 +36,25 @@
 # messages for the extensions which are otherwise ignored by other versions of
 # tic.
 
+USE_NCURSES=20190609
+
+failed() {
+	echo "? $*" >&2
+	exit 1
+}
+
+need_ncurses() {
+	failed "This terminal description relies on ncurses 6.1 $USE_NCURSES"
+}
+
+use_ncurses6() {
+	VER=`infocmp6 -V 2>/dev/null`
+	test -n "$VER" && INFOCMP_PROG=infocmp6
+	VER=`tic6 -V 2>/dev/null`
+	test -n "$VER" && TIC_PROG=tic6
+	test -z "$VER" && need_ncurses
+}
+
 MYTEMP=`mktemp -d 2>/dev/null`
 if test -z "$MYTEMP"
 then
@@ -64,22 +83,21 @@
 	# large numbers (used in xterm-direct) and large entries (an issue with
 	# xterm-nrc).
 	case "$VER" in
-	*\ [789].*|*\ 6.[123456789].*)
+	*\ [7-9].*|*\ 6.[1-9].20[12][0-9]*)
+		check=`echo "$VER" | sed -e 's/^.*\.//' -e 's/[^0-9].*$//'`
+		[ "$check" -lt "$USE_NCURSES" ] && use_ncurses6
 		;;
 	*)
 		# On systems with only ncurses 5, check for development version
 		# of ncurses.
-		VER=`infocmp6 -V 2>/dev/null`
-		test -n "$VER" && INFOCMP_PROG=infocmp6
-		VER=`tic6 -V 2>/dev/null`
-		test -n "$VER" && TIC_PROG=tic6
+		use_ncurses6
 		;;
 	esac
 	echo "** using tic from $VER"
 	# If this is 6.1.20180127 or later and using ABI 6, then it supports
 	# entries larger than 4096 bytes (up to 32768).
 	case "$VER" in
-	*\ [789].*|*\ 6.[123456789].*)
+	*\ [7-9].*|*\ 6.[1-9].20[12][0-9]*)
 		expect="	cols#100000,"
 		cat >$MYTEMP/fake.ti <<EOF
 fake|test 32-bit numbers,
Index: terminfo
--- xterm-352+/terminfo	2019-11-04 21:55:11.000000000 +0000
+++ xterm-353/terminfo	2020-01-18 18:38:40.000000000 +0000
@@ -1,10 +1,10 @@
-# $XTermId: terminfo,v 1.184 2019/11/04 21:55:11 tom Exp $
+# $XTermId: terminfo,v 1.185 2020/01/18 18:38:40 tom Exp $
 #
 # Updates/notes/new entries (e.g., xterm-8bit, xterm-16color, xterm-256color)
 # - Thomas E. Dickey
 #
 #------------------------------------------------------------------------------
-# Copyright 1996-2017,2019 by Thomas E. Dickey
+# Copyright 1996-2019,2020 by Thomas E. Dickey
 #
 #                         All Rights Reserved
 #
@@ -1534,7 +1534,7 @@
 	kpZRO=\EOp,
 	use=vt220+keypad,
 
-# from develoment after ncurses 5.2
+# from development after ncurses 5.2
 vt220+keypad|dec vt220 numeric keypad,
 	ka1=\EOw,
 	ka3=\EOy,
Index: trace.c
--- xterm-352+/trace.c	2019-11-20 09:28:05.000000000 +0000
+++ xterm-353/trace.c	2020-01-29 19:04:07.000000000 +0000
@@ -1,7 +1,7 @@
-/* $XTermId: trace.c,v 1.216 2019/11/20 09:28:05 tom Exp $ */
+/* $XTermId: trace.c,v 1.217 2020/01/29 19:04:07 tom Exp $ */
 
 /*
- * Copyright 1997-2018,2019 by Thomas E. Dickey
+ * Copyright 1997-2019,2020 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -443,6 +443,18 @@
 }
 
 const char *
+visibleMappingMode(int code)
+{
+    const char *result = "?";
+    switch (code) {
+	CASETYPE(MappingModifier);
+	CASETYPE(MappingKeyboard);
+	CASETYPE(MappingPointer);
+    }
+    return result;
+}
+
+const char *
 visibleNotifyMode(int code)
 {
     const char *result = "?";
@@ -840,6 +852,19 @@
 	       ev->xconfigure.border_width,
 	       ev->xconfigure.above));
 	break;
+    case CreateNotify:
+	TRACE((" at %d,%d size %dx%d bd %d",
+	       ev->xcreatewindow.y,
+	       ev->xcreatewindow.x,
+	       ev->xcreatewindow.height,
+	       ev->xcreatewindow.width,
+	       ev->xcreatewindow.border_width));
+	break;
+    case ResizeRequest:
+	TRACE((" size %dx%d",
+	       ev->xresizerequest.height,
+	       ev->xresizerequest.width));
+	break;
     case PropertyNotify:
 	TRACE((" %s %s",
 	       TraceAtomName(XtDisplay(toplevel), ev->xproperty.atom),
@@ -858,8 +883,33 @@
 	       ev->xexpose.width,
 	       ev->xexpose.count));
 	break;
+    case MappingNotify:
+	TRACE((" %s first_keycode %d count %d",
+	       visibleMappingMode(ev->xmapping.request),
+	       ev->xmapping.first_keycode,
+	       ev->xmapping.count));
+	break;
+    case VisibilityNotify:
+	TRACE((" state %d",
+	       ev->xvisibility.state));
+	break;
+    case KeymapNotify:
+	{
+	    Cardinal j;
+	    for (j = 0; j < XtNumber(ev->xkeymap.key_vector); ++j) {
+		if (ev->xkeymap.key_vector[j] != 0) {
+		    Cardinal k;
+		    for (k = 0; k < 8; ++k) {
+			if (ev->xkeymap.key_vector[j] & (1 << k)) {
+			    TRACE((" key%u", (j * 8) + k));
+			}
+		    }
+		}
+	    }
+	}
+	break;
     default:
-	TRACE(("FIXME\n"));
+	TRACE((":FIXME"));
 	break;
     }
     TRACE(("\n"));
Index: trace.h
--- xterm-352+/trace.h	2019-11-18 10:23:19.000000000 +0000
+++ xterm-353/trace.h	2020-01-29 18:48:24.000000000 +0000
@@ -1,7 +1,7 @@
-/* $XTermId: trace.h,v 1.90 2019/11/18 10:23:19 tom Exp $ */
+/* $XTermId: trace.h,v 1.91 2020/01/29 18:48:24 tom Exp $ */
 
 /*
- * Copyright 1997-2018,2019 by Thomas E. Dickey
+ * Copyright 1997-2019,2020 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -69,6 +69,7 @@
 extern	const char * visibleUChar(unsigned);
 extern	const char * visibleDblChrset(unsigned /* chrset */);
 extern	const char * visibleEventType (int);
+extern	const char * visibleMappingMode (int);
 extern	const char * visibleNotifyDetail(int /* code */);
 extern	const char * visibleNotifyMode (int /* code */);
 extern	const char * visibleScsCode(DECNRCM_codes /* chrset */);
Index: version.h
--- xterm-352+/version.h	2020-01-17 01:52:26.000000000 +0000
+++ xterm-353/version.h	2020-02-02 01:50:52.000000000 +0000
@@ -1,4 +1,4 @@
-/* $XTermId: version.h,v 1.484 2020/01/17 01:52:26 tom Exp $ */
+/* $XTermId: version.h,v 1.486 2020/02/02 01:50:52 tom Exp $ */
 
 /*
  * Copyright 1998-2019,2020 by Thomas E. Dickey
@@ -38,8 +38,8 @@
  * version of X to which this version of xterm has been built.  The resulting
  * number in parentheses is my patch number (Thomas E. Dickey).
  */
-#define XTERM_PATCH   352
-#define XTERM_DATE    2020-01-16
+#define XTERM_PATCH   353
+#define XTERM_DATE    2020-02-01
 
 #ifndef __vendorversion__
 #define __vendorversion__ "XTerm"
Index: vms.c
--- xterm-352+/vms.c	2010-10-11 08:05:35.000000000 +0000
+++ xterm-353/vms.c	2020-01-18 18:32:45.000000000 +0000
@@ -1,4 +1,4 @@
-/* $XTermId: vms.c,v 1.13 2010/10/11 08:05:35 tom Exp $ */
+/* $XTermId: vms.c,v 1.14 2020/01/18 18:32:45 tom Exp $ */
 
 /*  vms.c
  *
@@ -314,7 +314,7 @@
   /*  has special code for DECWINDOWS that will:                  */
   /*    1) do a DEFINE/JOB DECW$DISPLAY 'f$trnlnm(sys$error)'     */
   /*    2) then redefine SYS$ERROR to match SYS$OUTPUT!           */
-  /*  This will propogate DECW$DISPLAY to the XTERM process!!!    */
+  /*  This will propagate DECW$DISPLAY to the XTERM process!!!    */
   /*  Thanks go to Joel M Snyder who posted this info to INFO-VAX */
 
   flags = PRC$M_INTER | PRC$M_NOPASSWORD | PRC$M_DETACH;
@@ -381,8 +381,8 @@
 
 /*
  * This routine writes to the pseudo terminal.  If there is a free
- * buffer then write with an echo buffer completing asyncronously, else
- * write syncronously using the buffer reserved for writing.  All errors
+ * buffer then write with an echo buffer completing asynchronously, else
+ * write synchronously using the buffer reserved for writing.  All errors
  *  are fatal, except DATAOVERUN and DATALOST,these errors can be ignored.
 
  CAREFUL! Whatever calls this must NOT pass more than VMS_TERM_BUFFER_SIZE
@@ -554,7 +554,7 @@
  * page size changed.  If it did, resize the widget, otherwise, ignore
  * it!  This routine just gets the new term dimensions and sets a flag
  * to indicate the term chars have changed.  The widget gets resized in
- * the routine in_put in the module CHARPROC.C.  You cant resize the
+ * the routine in_put in the module CHARPROC.C.  You can't resize the
  * widget in this routine because this is an AST and X is not reenterent.
  */
 
@@ -563,7 +563,7 @@
   int status;
 
   /*
-   * Dont do anything if in Tek mode
+   * Don't do anything if in Tek mode
    */
 
   if(!(TScreenOf(term)->TekEmu))
Index: vttests/modify-keys.pl
--- xterm-352+/vttests/modify-keys.pl	2019-10-29 00:22:23.000000000 +0000
+++ xterm-353/vttests/modify-keys.pl	2020-01-18 18:38:44.000000000 +0000
@@ -1,9 +1,9 @@
 #!/usr/bin/env perl
-# $XTermId: modify-keys.pl,v 1.89 2019/10/29 00:22:23 tom Exp $
+# $XTermId: modify-keys.pl,v 1.90 2020/01/18 18:38:44 tom Exp $
 # -----------------------------------------------------------------------------
 # this file is part of xterm
 #
-# Copyright 2019 by Thomas E. Dickey
+# Copyright 2019,2020 by Thomas E. Dickey
 #
 #                         All Rights Reserved
 #
@@ -988,7 +988,7 @@
                         # different modifier combinations can produce the same
                         # keysym.  Since it appears that the slots that the
                         # user would expect are filled in first, just ignoring
-                        # the duplicate works well enought.
+                        # the duplicate works well enough.
                         if ( not $linkUsed{$value} ) {
                             $props .= " name=\"$value\"";
                             $linkUsed{$value} = 1;
Index: vttests/print-vt-chars.pl
Prereq:  1.21 
--- xterm-352+/vttests/print-vt-chars.pl	2018-08-31 15:47:30.000000000 +0000
+++ xterm-353/vttests/print-vt-chars.pl	2020-01-18 18:38:48.000000000 +0000
@@ -1,9 +1,9 @@
 #!/usr/bin/perl -w
-# $Id: print-vt-chars.pl,v 1.21 2018/08/31 15:47:30 tom Exp $
+# $Id: print-vt-chars.pl,v 1.22 2020/01/18 18:38:48 tom Exp $
 # -----------------------------------------------------------------------------
 # this file is part of xterm
 #
-# Copyright 2018 by Thomas E. Dickey
+# Copyright 2018,2020 by Thomas E. Dickey
 #
 #                         All Rights Reserved
 #
@@ -308,7 +308,7 @@
 &init_charset( "DEC_Technical",      0, '>',  3, 9, 0 );
 &init_charset( "French_Canadian2",   0, '9',  3, 9, 1 );
 &init_charset( "Norwegian_Danish",   0, '`',  3, 9, 1 );
-&init_charset( "Portugese",          0, '%6', 3, 9, 1 );
+&init_charset( "Portuguese",         0, '%6', 3, 9, 1 );
 &init_charset( "ISO_Greek_Supp",     1, 'F',  5, 9, 0 );
 &init_charset( "ISO_Hebrew_Supp",    1, 'H',  5, 9, 0 );
 &init_charset( "ISO_Latin_5_Supp",   1, 'M',  5, 9, 0 );
Index: xterm.appdata.xml
--- xterm-352+/xterm.appdata.xml	2020-01-17 01:55:26.000000000 +0000
+++ xterm-353/xterm.appdata.xml	2020-02-02 01:51:29.000000000 +0000
@@ -35,7 +35,7 @@
     <keyword>terminal</keyword>
   </keywords>
   <releases>
-    <release version="352" date="2020-01-16"/>
+    <release version="353" date="2020-02-01"/>
   </releases>
   <url type="homepage">https://invisible-island.net/xterm/</url>
   <update_contact>dickey@invisible-island.net</update_contact>
Index: xterm.h
--- xterm-352+/xterm.h	2020-01-11 00:32:42.000000000 +0000
+++ xterm-353/xterm.h	2020-02-01 14:22:29.000000000 +0000
@@ -1,4 +1,4 @@
-/* $XTermId: xterm.h,v 1.863 2020/01/11 00:32:42 tom Exp $ */
+/* $XTermId: xterm.h,v 1.864 2020/02/01 14:22:29 tom Exp $ */
 
 /*
  * Copyright 1999-2019,2020 by Thomas E. Dickey
@@ -1071,6 +1071,8 @@
 
 #if OPT_NUM_LOCK
 extern void VTInitModifiers(XtermWidget /* xw */);
+#else
+#define VTInitModifiers(xw) /* nothing */
 #endif
 
 /* linedata.c */
Index: xterm.log.html
--- xterm-352+/xterm.log.html	2020-01-17 01:56:23.000000000 +0000
+++ xterm-353/xterm.log.html	2020-02-02 01:52:14.000000000 +0000
@@ -30,7 +30,7 @@
  * sale, use or other dealings in this Software without prior written        *
  * authorization.                                                            *
  *****************************************************************************
-  $XTermId: xterm.log.html,v 1.2145 2020/01/17 01:56:23 tom Exp $
+  $XTermId: xterm.log.html,v 1.2153 2020/02/02 01:52:14 tom Exp $
   -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
 
@@ -73,6 +73,8 @@
   CHANGELOG</a>).</p>
 
   <ul>
+    <li><a href="#xterm_353">Patch #353 - 2020/02/01</a></li>
+
     <li><a href="#xterm_352">Patch #352 - 2020/01/16</a></li>
 
     <li><a href="#xterm_351">Patch #351 - 2019/11/17</a></li>
@@ -985,6 +987,38 @@
     <li><a href="#xterm_01">Patch #1 - 1996/1/6</a></li>
   </ul>
 
+  <h1><a name="xterm_353" id="xterm_353">Patch #353 -
+  2020/02/01</a></h1>
+
+  <ul>
+    <li>amend change in <a href="#xterm_352">patch #352</a> for
+    button-events to fix a case where some followup events were not
+    processed soon enough (report/patch by Jimmy Aguilar
+    Mena).</li>
+
+    <li>handle <em>MappingNotify</em> X event, to improve recovery
+    when switching keyboard configurations using
+    <code>xkbcomp</code> (prompted by discussion with Frank Mosch,
+    Debian #661295). There is more work needed here, possibly in
+    the X libraries.</li>
+
+    <li>improve discussion of mouse-mode in <code>ctlseqs.ms</code>
+    (suggested by Igor van den Hoven).</li>
+
+    <li>further improve checks for Xft <em>max-advance-width</em>
+    to take into account fonts which use two cells for ambiguous
+    width characters. Also improve the time used for these checks
+    (reports by Yuri Pankov, Frank Mosch).</li>
+
+    <li>fix a few spelling errors reported by codespell (report by
+    Jens Schleusener).</li>
+
+    <li>modify <code>run-tic.sh</code> to prefer development
+    version of ncurses since changes to terminfo file in <a href=
+    "#xterm_345">patch #345</a> rely upon bug-fixes in ncurses
+    (prompted by discussion with Will Senn).</li>
+  </ul>
+
   <h1><a name="xterm_352" id="xterm_352">Patch #352 -
   2020/01/16</a></h1>
 
@@ -1338,8 +1372,8 @@
 
     <li>reset flags including wraparound and reverse-wrap when
     switching to VT52 mode, while noting that DEC's standard
-    documention leaves that behavior <em>undefined</em> (report by
-    Thomas Wolff).</li>
+    documentation leaves that behavior <em>undefined</em> (report
+    by Thomas Wolff).</li>
 
     <li>ensure that italic font is turned off on hard/soft resets
     (report by Martin Hostettler).</li>
@@ -4346,7 +4380,7 @@
     whose detail is <code>NotifyPointer</code>, since those are
     sent in addition to focus-change events directed to the old/new
     windows having focus. In particular, this prevents the
-    urgency-hint from being reset inadvertantly (prompted by patch
+    urgency-hint from being reset inadvertently (prompted by patch
     by Balazs Kezes).</li>
 
     <li>modify description of <code>iconName</code> in manpage to
@@ -5577,7 +5611,7 @@
     is hidden (Debian #594856).</li>
 
     <li>further extend initialization for active-icon font to check
-    if the font was not loaded succesfully, to retry with
+    if the font was not loaded successfully, to retry with
     <code>font1</code>, or as even (if TrueType fonts are used) to
     use a TrueType font. The retries are to help with cases as in
     <a href="#xterm_241">patch #241</a> where the bitmap fonts are
@@ -7165,7 +7199,7 @@
 
     <li>add "spawn-new-terminal" action, which can be assigned to
     key translation, allowing one to spawn a new copy of xterm
-    using the current process' working directory (adapted from
+    using the current process's working directory (adapted from
     patch by Daniel Colascione).</li>
 
     <li>improve select/paste between UTF-8 and Latin1 xterms by
@@ -10129,7 +10163,7 @@
     rules to define location of app-defaults directory (Debian
     #87611).</li>
 
-    <li>review/update list of conflicting preprocesor symbols to
+    <li>review/update list of conflicting preprocessor symbols to
     remove from $CPPFLAGS at the end of the configure script. In
     particular, this allows one to configure xterm without the
     utempter library on Redhat 7.1 (report/patch by Adam
@@ -10302,7 +10336,7 @@
         behavior of other programs such as Rxvt, Kterm, Gedit.</li>
 
         <li>A tiny XIM bugfix is also included. By calling
-        XSetLocaleModifiers() with parameter of "", it can consier
+        XSetLocaleModifiers() with parameter of "", it can consider
         XMODIFIERS environmental variable which is a standard way
         for users to specify XIM server to be used.</li>
       </ul>
@@ -10364,7 +10398,7 @@
       <ul>
         <li>Xutf8TextListToTextProperty fully handles XStringstyle
         and XUTF8StringStyle. It will only generate STRING for
-        XStdICCTextStyle, and wil only generate Latin-1 in
+        XStdICCTextStyle, and will only generate Latin-1 in
         XCompoundTextStyle (but label it as COMPOUND_TEXT, as the
         spec requires). (I have hesitated to make this function
         fail for XStdICCTextStyle and XCompoundTextStyle; this
Index: xterm_io.h
--- xterm-352+/xterm_io.h	2020-01-01 16:28:23.000000000 +0000
+++ xterm-353/xterm_io.h	2020-01-18 18:48:19.000000000 +0000
@@ -1,4 +1,4 @@
-/* $XTermId: xterm_io.h,v 1.65 2018/06/28 21:35:01 tom Exp $ */
+/* $XTermId: xterm_io.h,v 1.67 2020/01/18 18:48:19 tom Exp $ */
 
 /*
  * Copyright 2000-2018,2020 by Thomas E. Dickey
@@ -218,7 +218,7 @@
 #endif
 
 #if defined (__sgi) || (defined(__linux__) && defined(__sparc__)) || defined(__UNIXWARE__)
-#undef TIOCLSET			/* defined, but not useable */
+#undef TIOCLSET			/* defined, but not usable */
 #endif
 
 #if defined(sun) || defined(__UNIXWARE__)
