]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 6.3 - patch 20220514
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 15 May 2022 00:51:18 +0000 (00:51 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 15 May 2022 00:51:18 +0000 (00:51 +0000)
+ further improvements to test/test_mouse.c; compare with ncurses test
  program menu A/a.

NEWS
VERSION
dist.mk
package/debian-mingw/changelog
package/debian-mingw64/changelog
package/debian/changelog
package/mingw-ncurses.nsi
package/mingw-ncurses.spec
package/ncurses.spec
package/ncursest.spec
test/test_mouse.c

diff --git a/NEWS b/NEWS
index bc881eb72aa4c07a98cb423771cb931882e8f098..364490a7b80d7cc7c41fb4138234ad36b59f9e8e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -26,7 +26,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: NEWS,v 1.3805 2022/05/07 22:42:19 tom Exp $
+-- $Id: NEWS,v 1.3807 2022/05/14 22:56:52 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -46,6 +46,10 @@ See the AUTHORS file for the corresponding full names.
 Changes through 1.9.9e did not credit all contributions;
 it is not possible to add this information.
 
+20220514
+       + further improvements to test/test_mouse.c; compare with ncurses test
+         program menu A/a.
+
 20220507
        + add test/test_mouse.c (patch by Leonid S Usov).
        + add a few debug-traces for tic, fix a couple of memory-leaks.
diff --git a/VERSION b/VERSION
index 59123a3165188bc964f53885e4130c818007dc30..ba8e643a3c0b2a24b9d729d3b2562c41573d7334 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-5:0:10 6.3     20220507
+5:0:10 6.3     20220514
diff --git a/dist.mk b/dist.mk
index 5c0e01ad2dae4e3687a69bffde848ff3e812f62a..d5a51323a516d0b0a9bf9e97952098e7596aa250 100644 (file)
--- a/dist.mk
+++ b/dist.mk
@@ -26,7 +26,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: dist.mk,v 1.1479 2022/05/07 11:09:45 tom Exp $
+# $Id: dist.mk,v 1.1480 2022/05/14 13:23:05 tom Exp $
 # Makefile for creating ncurses distributions.
 #
 # This only needs to be used directly as a makefile by developers, but
@@ -38,7 +38,7 @@ SHELL = /bin/sh
 # These define the major/minor/patch versions of ncurses.
 NCURSES_MAJOR = 6
 NCURSES_MINOR = 3
-NCURSES_PATCH = 20220507
+NCURSES_PATCH = 20220514
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index 4a68d709c5a76ada2f9a66b5f83c6c3853dc9c61..13d69d31e3d076e412b92cad02087e4135f73fdc 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.3+20220507) unstable; urgency=low
+ncurses6 (6.3+20220514) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 07 May 2022 07:09:45 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 14 May 2022 09:23:05 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index 4a68d709c5a76ada2f9a66b5f83c6c3853dc9c61..13d69d31e3d076e412b92cad02087e4135f73fdc 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.3+20220507) unstable; urgency=low
+ncurses6 (6.3+20220514) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 07 May 2022 07:09:45 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 14 May 2022 09:23:05 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index 1c7bc2e6425bb451545677c4babe9bffd35d5ff5..733d47ad68d7e68f5740baa70f3423c6dd0b7247 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.3+20220507) unstable; urgency=low
+ncurses6 (6.3+20220514) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 07 May 2022 07:09:45 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 14 May 2022 09:23:05 -0400
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
index 19d5c83ecf18334ab91058ac0f1050dcfc5c41bf..88e6a31434c292a5b396b94720982e2d266c9db1 100644 (file)
@@ -1,4 +1,4 @@
-; $Id: mingw-ncurses.nsi,v 1.519 2022/05/07 11:09:45 tom Exp $\r
+; $Id: mingw-ncurses.nsi,v 1.520 2022/05/14 13:23:05 tom Exp $\r
 \r
 ; TODO add examples\r
 ; TODO bump ABI to 6\r
@@ -10,7 +10,7 @@
 !define VERSION_MAJOR "6"\r
 !define VERSION_MINOR "3"\r
 !define VERSION_YYYY  "2022"\r
-!define VERSION_MMDD  "0507"\r
+!define VERSION_MMDD  "0514"\r
 !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
 \r
 !define MY_ABI   "5"\r
index 64364f9aeb9e96292bc6328f86effee3d7aa1b64..681da256ce97e8d3879b0004557b1083f95b622c 100644 (file)
@@ -3,7 +3,7 @@
 Summary: shared libraries for terminal handling
 Name: mingw32-ncurses6
 Version: 6.3
-Release: 20220507
+Release: 20220514
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index ad46e5ed7f77e20e2abd70565780608c24a644a6..b775866e28c9f450d8ed218376158897714d6901 100644 (file)
@@ -1,7 +1,7 @@
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Version: 6.3
-Release: 20220507
+Release: 20220514
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index a9be86f2c7f526a535fdae3fd0a475628d02f133..dd8f8afb5b26ce23d8d28dd600e5c5f257abd616 100644 (file)
@@ -1,7 +1,7 @@
 Summary: Curses library with POSIX thread support.
 Name: ncursest6
 Version: 6.3
-Release: 20220507
+Release: 20220514
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index f96d658ceb95aa9743256ee7669cbddf1523b324..8cb12d9fc6e17b25612ae2c912d5a7f24886e827 100644 (file)
@@ -22,7 +22,7 @@
  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
  ****************************************************************************/
 /*
- * $Id: test_mouse.c,v 1.8 2022/05/08 00:36:07 tom Exp $
+ * $Id: test_mouse.c,v 1.18 2022/05/15 00:20:27 tom Exp $
  *
  * Author: Leonid S Usov
  *
@@ -47,7 +47,7 @@ raw_loop(void)
 
     setupterm(NULL, 0, 0);
     xtermcap = tigetstr("XM");
-    if (xtermcap == 0 || xtermcap == (char *) -1) {
+    if (!VALID_STRING(xtermcap)) {
        fprintf(stderr, "couldn't get XM terminfo");
        return 1;
     }
@@ -61,16 +61,16 @@ raw_loop(void)
        int c = getc(stdin);
        const char *pretty;
 
-       if (c == ERR || c == '\003') {
+       if (c == -1 || c == '\003') {
            break;
        } else if (c == '\033') {
-           printf("\r\n");
+           printf("\r\n\\E");
        } else if ((pretty = unctrl((chtype) c)) != NULL) {
            printf("%s", pretty);
        } else if (isprint(c)) {
            printf("%c", c);
        } else {
-           printf("{%x}", c);
+           printf("{%x}", UChar(c));
        }
     }
 
@@ -80,26 +80,27 @@ raw_loop(void)
     return 0;
 }
 
-static int logw(int line, const char *fmt, ...) GCC_PRINTFLIKE(2, 3);
+static void logw(const char *fmt, ...) GCC_PRINTFLIKE(1, 2);
 
-static int
-logw(int line, const char *fmt, ...)
+static void
+logw(const char *fmt, ...)
 {
+    int row = getcury(stdscr);
+
     va_list args;
     va_start(args, fmt);
-    wmove(stdscr, line++, 0);
+    wmove(stdscr, row++, 0);
     vw_printw(stdscr, fmt, args);
     clrtoeol();
 
-    line %= (getmaxy(stdscr) - logoffset);
-    if (line < logoffset) {
-       line = logoffset;
+    row %= (getmaxy(stdscr) - logoffset);
+    if (row < logoffset) {
+       row = logoffset;
     }
 
-    wmove(stdscr, line, 0);
+    wmove(stdscr, row, 0);
     wprintw(stdscr, ">");
     clrtoeol();
-    return line;
 }
 
 static void
@@ -117,7 +118,7 @@ usage(void)
        "",
        "Options:",
        " -r       show raw input stream, injecting a new line before every ESC",
-       " -i n     set mouse interval to n; default is 0",
+       " -i n     set mouse interval to n; default is 0 (no double-clicks)",
        " -h       show this message",
        " -T term  use terminal description other than $TERM"
     };
@@ -132,10 +133,9 @@ main(int argc, char *argv[])
 {
     bool rawmode = FALSE;
     int interval = 0;
-    int curline;
     int c;
     MEVENT event;
-    char *my_environ;
+    char *my_environ = NULL;
     const char *term_format = "TERM=%s";
 
     while ((c = getopt(argc, argv, "hi:rT:")) != -1) {
@@ -170,7 +170,6 @@ main(int argc, char *argv[])
     }
 
     initscr();
-    clear();
     noecho();
     cbreak();                  /* Line buffering disabled; pass everything */
     nonl();
@@ -180,10 +179,11 @@ main(int argc, char *argv[])
     mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL);
     mouseinterval(interval);
 
-    logoffset = logw(logoffset, "Ctrl-c to quit");
-    logoffset = logw(logoffset, "--------------");
-
-    curline = logoffset;
+    logw("Ctrl-c to quit");
+    logw("--------------");
+    if (my_environ)
+       logw("%s", my_environ);
+    logoffset = getcury(stdscr);
 
     while (1) {
        c = getch();
@@ -198,35 +198,63 @@ main(int argc, char *argv[])
 #else
                const int max_btn = 4;
 #endif
+               const mmask_t btn_mask = (NCURSES_BUTTON_RELEASED |
+                                         NCURSES_BUTTON_PRESSED |
+                                         NCURSES_BUTTON_CLICKED |
+                                         NCURSES_DOUBLE_CLICKED |
+                                         NCURSES_TRIPLE_CLICKED);
+               bool found = FALSE;
                for (btn = 1; btn <= max_btn; btn++) {
                    events = (mmask_t) (event.bstate
-                                       & NCURSES_MOUSE_MASK(btn,
-                                                            NCURSES_BUTTON_RELEASED |
-                                                            NCURSES_BUTTON_PRESSED |
-                                                            NCURSES_BUTTON_CLICKED |
-                                                            NCURSES_DOUBLE_CLICKED |
-                                                            NCURSES_TRIPLE_CLICKED));
+                                       & NCURSES_MOUSE_MASK(btn, btn_mask));
                    if (events == 0)
                        continue;
-#define Show(btn,name) ((event.bstate & NCURSES_MOUSE_MASK(btn, name)) != 0) ? #name : ""
-                   curline = logw(curline,
-                                  "button %d %s %s %s %s %s %d[%x] @ %d, %d",
-                                  btn,
-                                  Show(btn, NCURSES_BUTTON_RELEASED),
-                                  Show(btn, NCURSES_BUTTON_PRESSED),
-                                  Show(btn, NCURSES_BUTTON_CLICKED),
-                                  Show(btn, NCURSES_DOUBLE_CLICKED),
-                                  Show(btn, NCURSES_TRIPLE_CLICKED),
-                                  (event.bstate & REPORT_MOUSE_POSITION) != 0,
-                                  events,
-                                  event.y, event.x);
+#define ShowQ(btn,name) \
+       (((event.bstate & NCURSES_MOUSE_MASK(btn, NCURSES_ ## name)) != 0) \
+        ? (" " #name) \
+        : "")
+#define ShowM(name) \
+       (((event.bstate & NCURSES_MOUSE_MASK(btn, BUTTON_ ## name)) != 0) \
+        ? (" " #name) \
+        : "")
+#define ShowP() \
+        ((event.bstate & REPORT_MOUSE_POSITION) != 0 \
+         ? " position" \
+         : "")
+                   logw("[%08lX] button %d%s%s%s%s%s%s%s%s%s @ %d, %d",
+                        (unsigned long) events,
+                        btn,
+                        ShowQ(btn, BUTTON_RELEASED),
+                        ShowQ(btn, BUTTON_PRESSED),
+                        ShowQ(btn, BUTTON_CLICKED),
+                        ShowQ(btn, DOUBLE_CLICKED),
+                        ShowQ(btn, TRIPLE_CLICKED),
+                        ShowM(SHIFT),
+                        ShowM(CTRL),
+                        ShowM(ALT),
+                        ShowP(),
+                        event.y, event.x);
+                   found = TRUE;
+               }
+               /*
+                * A position report need not have a button associated with it.
+                * The modifiers probably are unused.
+                */
+               if (!found && (event.bstate & REPORT_MOUSE_POSITION)) {
+                   logw("[%08lX]%s%s%s%s @ %d, %d",
+                        (unsigned long) events,
+                        ShowM(SHIFT),
+                        ShowM(CTRL),
+                        ShowM(ALT),
+                        ShowP(),
+                        event.y, event.x);
                }
            }
            break;
        case '\003':
            goto end;
        default:
-           curline = logw(curline, "got another char: 0x%x", c);
+           logw("got another char: 0x%x", UChar(c));
        }
        refresh();
     }