# ftp://ftp.invisible-island.net/xterm/patches/xterm-356.patch.gz
# patch by Thomas E. Dickey <dickey@invisible-island.net>
# created  Sun May  3 00:50:53 UTC 2020
# ------------------------------------------------------------------------------
# MANIFEST                 |    2 +-
# button.c                 |   16 +++++-----------
# charproc.c               |   10 ++++++++--
# package/debian/changelog |    6 ++++++
# package/freebsd/Makefile |    4 ++--
# package/pkgsrc/Makefile  |    2 +-
# package/xterm.spec       |    4 ++--
# ptyx.h                   |    3 +--
# version.h                |    6 +++---
# xterm.appdata.xml        |    2 +-
# xterm.log.html           |   12 +++++++++++-
# 11 files changed, 41 insertions(+), 26 deletions(-)
# ------------------------------------------------------------------------------
Index: MANIFEST
--- xterm-355+/MANIFEST	2020-04-27 18:58:28.000000000 +0000
+++ xterm-356/MANIFEST	2020-05-02 10:19:22.000000000 +0000
@@ -1,4 +1,4 @@
-MANIFEST for xterm-355, version xterm-355
+MANIFEST for xterm-356, version xterm-356
 --------------------------------------------------------------------------------
 MANIFEST                        this file
 256colres.h                     resource-definitions for 256-color mode
Index: button.c
--- xterm-355+/button.c	2020-04-30 23:16:03.000000000 +0000
+++ xterm-356/button.c	2020-05-02 16:49:20.000000000 +0000
@@ -1,4 +1,4 @@
-/* $XTermId: button.c,v 1.579 2020/04/30 23:16:03 tom Exp $ */
+/* $XTermId: button.c,v 1.580 2020/05/02 16:49:20 tom Exp $ */
 
 /*
  * Copyright 1999-2019,2020 by Thomas E. Dickey
@@ -4830,13 +4830,6 @@
     unsigned count = 0;
     Boolean changed = True;
 
-    /*
-     * Avoid making multiple replies due to multiple actions per event.
-     */
-    if (screen->last_mouse == event->serial)
-	return;
-    screen->last_mouse = event->serial;
-
     /* If button event, get button # adjusted for DEC compatibility */
     button = (int) (event->button - 1);
     if (button >= 3)
@@ -4919,11 +4912,12 @@
 	case ButtonRelease:
 	    /*
 	     * The (vertical) wheel mouse interface generates release-events
-	     * for buttons 4 and 5, coded here as 3 and 4 respectively.
+	     * for buttons 4 and 5.
 	     *
 	     * The X10/X11 xterm protocol maps the release for buttons 1..3 to
 	     * a -1, which will be later mapped into a "0" (some button was
-	     * released),
+	     * released),  At this point, buttons 1..3 are encoded 0..2 (the
+	     * code 3 is unused).
 	     *
 	     * The SGR (extended) xterm mouse protocol keeps the button number
 	     * and uses a "m" to indicate button release.
@@ -4932,7 +4926,7 @@
 	     * revised -TD
 	     */
 	    screen->mouse_button &= ~ButtonBit(button);
-	    if (button < 3 || button >= 8) {
+	    if (button < 3 || button > 5) {
 		switch (screen->extend_coords) {
 		case SET_SGR_EXT_MODE_MOUSE:
 		    final = 'm';
Index: charproc.c
--- xterm-355+/charproc.c	2020-04-27 22:35:45.000000000 +0000
+++ xterm-356/charproc.c	2020-05-02 16:26:20.000000000 +0000
@@ -1,4 +1,4 @@
-/* $XTermId: charproc.c,v 1.1747 2020/04/27 22:35:45 tom Exp $ */
+/* $XTermId: charproc.c,v 1.1748 2020/05/02 16:26:20 tom Exp $ */
 
 /*
  * Copyright 1999-2019,2020 by Thomas E. Dickey
@@ -12563,7 +12563,13 @@
 	   (void *) w, visibleEventType(event->type)));
     if ((xw = getXtermWidget(w)) != 0) {
 	/* do nothing, but check for funny escape sequences */
-	(void) SendMousePosition(xw, event);
+	switch (event->type) {
+	case ButtonPress:
+	case ButtonRelease:
+	default:
+	    (void) SendMousePosition(xw, event);
+	    break;
+	}
     }
 }
 
Index: package/debian/changelog
--- xterm-355+/package/debian/changelog	2020-04-27 18:58:28.000000000 +0000
+++ xterm-356/package/debian/changelog	2020-05-02 10:19:22.000000000 +0000
@@ -1,3 +1,9 @@
+xterm-dev (356) unstable; urgency=low
+
+  * maintenance updates
+
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 02 May 2020 06:19:22 -0400
+
 xterm-dev (355) unstable; urgency=low
 
   * maintenance updates
Index: package/freebsd/Makefile
--- xterm-355+/package/freebsd/Makefile	2020-04-27 18:58:28.000000000 +0000
+++ xterm-356/package/freebsd/Makefile	2020-05-02 10:19:22.000000000 +0000
@@ -1,4 +1,4 @@
-# $XTermId: Makefile,v 1.76 2020/04/27 18:58:28 tom Exp $
+# $XTermId: Makefile,v 1.77 2020/05/02 10:19:22 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=	355
+PORTVERSION=	356
 CATEGORIES=	x11
 MASTER_SITES=	ftp://ftp.invisible-island.net/xterm/:src1 \
 		https://invisible-mirror.net/archives/xterm/:src1
Index: package/pkgsrc/Makefile
--- xterm-355+/package/pkgsrc/Makefile	2020-04-27 18:58:28.000000000 +0000
+++ xterm-356/package/pkgsrc/Makefile	2020-05-02 10:19:22.000000000 +0000
@@ -1,6 +1,6 @@
 # $NetBSD: Makefile,v 1.117 2018/03/12 11:18:00 wiz Exp $
 
-DISTNAME=	xterm-355
+DISTNAME=	xterm-356
 PKGREVISION=	1
 CATEGORIES=	x11
 MASTER_SITES=	ftp://ftp.invisible-island.net/xterm/
Index: package/xterm.spec
--- xterm-355+/package/xterm.spec	2020-04-27 18:58:28.000000000 +0000
+++ xterm-356/package/xterm.spec	2020-05-02 10:19:22.000000000 +0000
@@ -1,11 +1,11 @@
-# $XTermId: xterm.spec,v 1.129 2020/04/27 18:58:28 tom Exp $
+# $XTermId: xterm.spec,v 1.130 2020/05/02 10:19:22 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: 355
+Version: 356
 Release: 1
 License: X11
 Group: User Interface/X
Index: ptyx.h
--- xterm-355+/ptyx.h	2020-04-30 23:15:39.000000000 +0000
+++ xterm-356/ptyx.h	2020-05-02 16:11:37.000000000 +0000
@@ -1,4 +1,4 @@
-/* $XTermId: ptyx.h,v 1.991 2020/04/30 23:15:39 tom Exp $ */
+/* $XTermId: ptyx.h,v 1.992 2020/05/02 16:11:37 tom Exp $ */
 
 /*
  * Copyright 1999-2019,2020 by Thomas E. Dickey
@@ -2318,7 +2318,6 @@
 	int		border;		/* inner border			*/
 	int		scrollBarBorder; /* scrollBar border		*/
 	long		event_mask;
-	unsigned long	last_mouse;	/* serial of last mouse-event	*/
 	unsigned	send_mouse_pos;	/* user wants mouse transition  */
 					/* and position information	*/
 	int		extend_coords;	/* support large terminals	*/
Index: version.h
--- xterm-355+/version.h	2020-05-01 07:51:33.000000000 +0000
+++ xterm-356/version.h	2020-05-02 10:19:22.000000000 +0000
@@ -1,4 +1,4 @@
-/* $XTermId: version.h,v 1.490 2020/05/01 07:51:33 tom Exp $ */
+/* $XTermId: version.h,v 1.491 2020/05/02 10:19:22 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   355
-#define XTERM_DATE    2020-05-01
+#define XTERM_PATCH   356
+#define XTERM_DATE    2020-05-02
 
 #ifndef __vendorversion__
 #define __vendorversion__ "XTerm"
Index: xterm.appdata.xml
--- xterm-355+/xterm.appdata.xml	2020-05-01 07:53:01.000000000 +0000
+++ xterm-356/xterm.appdata.xml	2020-05-03 00:11:07.000000000 +0000
@@ -35,7 +35,7 @@
     <keyword>terminal</keyword>
   </keywords>
   <releases>
-    <release version="355" date="2020-05-01"/>
+    <release version="356" date="2020-05-02"/>
   </releases>
   <url type="homepage">https://invisible-island.net/xterm/</url>
   <update_contact>dickey@invisible-island.net</update_contact>
Index: xterm.log.html
--- xterm-355+/xterm.log.html	2020-05-01 07:51:48.000000000 +0000
+++ xterm-356/xterm.log.html	2020-05-03 00:10:44.000000000 +0000
@@ -30,7 +30,7 @@
  * sale, use or other dealings in this Software without prior written        *
  * authorization.                                                            *
  *****************************************************************************
-  $XTermId: xterm.log.html,v 1.2184 2020/05/01 07:51:48 tom Exp $
+  $XTermId: xterm.log.html,v 1.2187 2020/05/03 00:10:44 tom Exp $
   -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
 
@@ -73,6 +73,8 @@
   CHANGELOG</a>).</p>
 
   <ul>
+    <li><a href="#xterm_356">Patch #356 - 2020/05/02</a></li>
+
     <li><a href="#xterm_355">Patch #355 - 2020/05/01</a></li>
 
     <li><a href="#xterm_354">Patch #354 - 2020/04/26</a></li>
@@ -991,6 +993,14 @@
     <li><a href="#xterm_01">Patch #1 - 1996/1/6</a></li>
   </ul>
 
+  <h1><a name="xterm_356" id="xterm_356">Patch #356 -
+  2020/05/02</a></h1>
+
+  <ul>
+    <li>revise fix for Debian #954730, which interfered with wheel
+    mouse events (report by Gabriele Balducci).</li>
+  </ul>
+
   <h1><a name="xterm_355" id="xterm_355">Patch #355 -
   2020/05/01</a></h1>
 
