ncurses 5.7 - patch 20100206
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 7 Feb 2010 01:40:29 +0000 (01:40 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 7 Feb 2010 01:40:29 +0000 (01:40 +0000)
+ update mrxvt terminfo entry -TD
+ modify win_driver.c to support mouse single-clicks.
+ correct name for termlib in ncurses*-config, e.g., if it is renamed
  to provide a single file for ncurses/ncursesw libraries (patch by
  Miroslav Lichvar).

NEWS
dist.mk
misc/gen-pkgconfig.in
misc/ncurses-config.in
misc/terminfo.src
ncurses/base/lib_getch.c
ncurses/base/lib_mouse.c
ncurses/curses.priv.h
ncurses/win32con/win_driver.c

diff --git a/NEWS b/NEWS
index 24bae12948e8d6e072922523349ed501d8f064bd..5e536d2109d0e49ee2761db237e8cde0b75990c1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1500 2010/01/30 23:48:39 tom Exp $
+-- $Id: NEWS,v 1.1503 2010/02/06 22:16:30 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,13 @@ 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.
 
+20100206
+       + update mrxvt terminfo entry -TD
+       + modify win_driver.c to support mouse single-clicks.
+       + correct name for termlib in ncurses*-config, e.g., if it is renamed
+         to provide a single file for ncurses/ncursesw libraries (patch by
+         Miroslav Lichvar).
+
 20100130
        + use vfork in test/ditto.c if available (request by Mike Frysinger).
        + miscellaneous cleanup of manpages.
diff --git a/dist.mk b/dist.mk
index 0f970c22baae4be24a9885c4c1950241ef96693b..14b0b9ac8f2b73aa66f7094cd5ba5d0072fa713f 100644 (file)
--- a/dist.mk
+++ b/dist.mk
@@ -25,7 +25,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: dist.mk,v 1.744 2010/01/30 18:27:04 tom Exp $
+# $Id: dist.mk,v 1.745 2010/02/06 15:00:38 tom Exp $
 # Makefile for creating ncurses distributions.
 #
 # This only needs to be used directly as a makefile by developers, but
@@ -37,7 +37,7 @@ SHELL = /bin/sh
 # These define the major/minor/patch versions of ncurses.
 NCURSES_MAJOR = 5
 NCURSES_MINOR = 7
-NCURSES_PATCH = 20100130
+NCURSES_PATCH = 20100206
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index 35ae12602e8cc6ca9b7bdf419229345e8d040cae..efd29105b571c33ccf5cfe119e61bb254ad6fa6e 100644 (file)
@@ -1,7 +1,7 @@
 #!@SHELL@
-# $Id: gen-pkgconfig.in,v 1.7 2009/03/14 20:37:54 tom Exp $
+# $Id: gen-pkgconfig.in,v 1.8 2010/02/06 22:12:07 Miroslav.Lichvar Exp $
 ##############################################################################
-# Copyright (c) 2009 Free Software Foundation, Inc.                          #
+# Copyright (c) 2009,2010 Free Software Foundation, Inc.                     #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -44,6 +44,7 @@ MENU_NAME=menu # @MENU_NAME@
 FORM_NAME=form # @FORM_NAME@
 CXX_NAME=ncurses++ # @CXX_NAME@
 DFT_DEP_SUFFIX=@DFT_DEP_SUFFIX@
+TINFO_ARG_SUFFIX=@TINFO_ARG_SUFFIX@
 CXX_LIB_SUFFIX=@CXX_LIB_SUFFIX@
 
 prefix="@prefix@"
@@ -57,16 +58,14 @@ show_includedir='@includedir@'
 show_libdir='@libdir@'
 
 MAIN_LIBRARY="${LIB_NAME}@DFT_ARG_SUFFIX@"
-SUB_LIBRARY="${TINFO_NAME}@DFT_ARG_SUFFIX@"
+SUB_LIBRARY="${TINFO_ARG_SUFFIX}"
 PANEL_LIBRARY="${PANEL_NAME}@DFT_ARG_SUFFIX@"
 MENU_LIBRARY="${MENU_NAME}@DFT_ARG_SUFFIX@"
 FORM_LIBRARY="${FORM_NAME}@DFT_ARG_SUFFIX@"
 
 SUB_LIBRARY_REQ=${SUB_LIBRARY}
-TINFO_NAME_REQ=${TINFO_NAME}
 if test $TINFO_NAME = $LIB_NAME ; then
        SUB_LIBRARY_REQ=
-       TINFO_NAME_REQ=
 fi
 
 for lib in ../lib/*
@@ -88,7 +87,7 @@ do
 
        desc="ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@"
        if test $name = $MAIN_LIBRARY ; then
-               reqs=$TINFO_NAME_REQ
+               reqs=$SUB_LIBRARY_REQ
                desc="$desc library"
        elif test $name = $SUB_LIBRARY ; then
                reqs=
index 8baf47881c3716bf961613c5bb5e39cdcfa45b1f..06261a747fcf9f46066fcef59cdf2ff8546e3198 100644 (file)
@@ -1,7 +1,7 @@
 #!@SHELL@
-# $Id: ncurses-config.in,v 1.23 2009/03/14 19:20:57 Charles.Wilson Exp $
+# $Id: ncurses-config.in,v 1.24 2010/02/06 22:12:16 Miroslav.Lichvar Exp $
 ##############################################################################
-# Copyright (c) 2006-2007,2009 Free Software Foundation, Inc.                #
+# Copyright (c) 2006-2009,2010 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -40,7 +40,7 @@ datadir="@datadir@"
 mandir="@mandir@"
 
 THIS="@LIB_NAME@@DFT_ARG_SUFFIX@"
-TINFO_LIB="@TINFO_NAME@@DFT_ARG_SUFFIX@"
+TINFO_LIB="@TINFO_ARG_SUFFIX@"
 
 LANG=C;                export LANG
 LANGUAGE=C;    export LANGUAGE
index d8f1776f7c7e3e4ff49e83631665d64f137e5a76..7c02d1f90b502c3e4a253c8d5cdce307b9418d37 100644 (file)
@@ -6,8 +6,8 @@
 # Report bugs and new terminal descriptions to
 #      bug-ncurses@gnu.org
 #
-#      $Revision: 1.358 $
-#      $Date: 2009/12/26 19:36:05 $
+#      $Revision: 1.359 $
+#      $Date: 2010/02/06 20:55:33 $
 #
 # The original header is preserved below for reference.  It is noted that there
 # is a "newer" version which differs in some cosmetic details (but actually
@@ -4038,12 +4038,21 @@ rxvt-cygwin-native|rxvt terminal emulator (native MS Window System port) on cygw
 rxvt-16color|xterm with 16 colors like aixterm,
        ncv#32, use=ibm+16color, use=rxvt,
 
-# mrxvt 0.5.3
+# mrxvt 0.5.4
 #
 # mrxvt is based on rxvt 2.7.11, but has by default XTERM_FKEYS defined, which
 # makes its function-keys different from other flavors of rxvt -TD
 mrxvt|multitabbed rxvt,
-       use=xterm+pcc2, use=xterm+r6f2, use=rxvt,
+       kEND=\E[8;2~, kHOM=\E[7;2~, kcub1=\E[D, kcud1=\E[B,
+       kcuf1=\E[C, kcuu1=\E[A, kend=\E[8~, khome=\E[7~,
+       kEND3=\E[8;3~, kEND4=\E[8;4~, kEND5=\E[8;5~,
+       kEND6=\E[8;6~, kEND7=\E[8;7~, kHOM3=\E[7;3~,
+       kHOM4=\E[7;4~, kHOM5=\E[7;5~, kHOM6=\E[7;6~,
+       kHOM7=\E[7;7~, use=xterm+r6f2, use=xterm+pcfkeys,
+       use=rxvt,
+
+mrxvt-256color|multitabbed rxvt with 256 colors,
+       use=xterm+256color, use=mrxvt,
 
 # From: Michael Jennings <mej@valinux.com>
 #
@@ -22084,6 +22093,9 @@ v3220|LANPAR Vision II model 3220/3221/3222,
 #      * add bterm (bogl 0.1.18) -TD
 #      * minor fix to rxvt+pcfkeys -TD
 #
+# 2010-02-06
+#      * update mrxvt to 0.5.4, add mrxvt-256color -TD
+#
 # The following sets edit modes for GNU EMACS.
 # Local Variables:
 # fill-prefix:"\t"
index f6520c068edc2dff613007b05723c373954a13cb..e3e4075f742ed40950812362c61f47f10fe04cc4 100644 (file)
@@ -42,7 +42,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_getch.c,v 1.109 2009/10/24 21:58:34 tom Exp $")
+MODULE_ID("$Id: lib_getch.c,v 1.110 2010/02/06 18:39:16 tom Exp $")
 
 #include <fifo_defs.h>
 
@@ -256,6 +256,14 @@ fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
        ch = KEY_MOUSE;
        n = 1;
     } else
+#endif
+#ifdef USE_TERM_DRIVER
+       if ((sp->_mouse_type == M_TERM_DRIVER)
+           && (sp->_drv_mouse_head < sp->_drv_mouse_tail)) {
+       sp->_mouse_event(sp);
+       ch = KEY_MOUSE;
+       n = 1;
+    } else
 #endif
     {                          /* Can block... */
 #ifdef USE_TERM_DRIVER
index e60e6be8df79f4fea18b23e5578e705ddef3a60c..f388e66e8d8e57c974206d7c9512db5f0466d152 100644 (file)
@@ -84,7 +84,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_mouse.c,v 1.111 2010/01/02 21:06:52 tom Exp $")
+MODULE_ID("$Id: lib_mouse.c,v 1.112 2010/02/06 19:54:08 tom Exp $")
 
 #include <tic.h>
 
@@ -678,7 +678,7 @@ _nc_mouse_init(SCREEN *sp)
  * fifo_push() in lib_getch.c
  */
 static bool
-_nc_mouse_event(SCREEN *sp GCC_UNUSED)
+_nc_mouse_event(SCREEN *sp)
 {
     MEVENT *eventp = sp->_mouse_eventp;
     bool result = FALSE;
@@ -778,6 +778,28 @@ _nc_mouse_event(SCREEN *sp GCC_UNUSED)
        break;
 #endif /* USE_SYSMOUSE */
 
+#ifdef USE_TERM_DRIVER
+    case M_TERM_DRIVER:
+       while (sp->_drv_mouse_head < sp->_drv_mouse_tail) {
+           *eventp = sp->_drv_mouse_fifo[sp->_drv_mouse_head];
+
+           /*
+            * Point the fifo-head to the next possible location.  If there
+            * are none, reset the indices.
+            */
+           sp->_drv_mouse_head += 1;
+           if (sp->_drv_mouse_head == sp->_drv_mouse_tail) {
+               sp->_drv_mouse_tail = 0;
+               sp->_drv_mouse_head = 0;
+           }
+
+           /* bump the next-free pointer into the circular list */
+           sp->_mouse_eventp = eventp = NEXT(eventp);
+           result = TRUE;
+       }
+       break;
+#endif
+
     case M_NONE:
        break;
     }
@@ -974,6 +996,11 @@ mouse_activate(SCREEN *sp, bool on)
            signal(SIGUSR2, handle_sysmouse);
            sp->_mouse_active = TRUE;
            break;
+#endif
+#ifdef USE_TERM_DRIVER
+       case M_TERM_DRIVER:
+           sp->_mouse_active = TRUE;
+           break;
 #endif
        case M_NONE:
            return;
@@ -1003,6 +1030,11 @@ mouse_activate(SCREEN *sp, bool on)
            signal(SIGUSR2, SIG_IGN);
            sp->_mouse_active = FALSE;
            break;
+#endif
+#ifdef USE_TERM_DRIVER
+       case M_TERM_DRIVER:
+           sp->_mouse_active = FALSE;
+           break;
 #endif
        case M_NONE:
            return;
@@ -1240,6 +1272,11 @@ _nc_mouse_wrap(SCREEN *sp)
     case M_SYSMOUSE:
        mouse_activate(sp, FALSE);
        break;
+#endif
+#ifdef USE_TERM_DRIVER
+    case M_TERM_DRIVER:
+       mouse_activate(sp, FALSE);
+       break;
 #endif
     case M_NONE:
        break;
@@ -1272,6 +1309,13 @@ _nc_mouse_resume(SCREEN *sp)
        mouse_activate(sp, TRUE);
        break;
 #endif
+
+#ifdef USE_TERM_DRIVER
+    case M_TERM_DRIVER:
+       mouse_activate(sp, TRUE);
+       break;
+#endif
+
     case M_NONE:
        break;
     }
index 0ef4879548d9cb690dc96a228cf22b3399d5f4b1..7d75ebae36c9965352d69cdcbab0f8ce73255201 100644 (file)
@@ -35,7 +35,7 @@
 
 
 /*
- * $Id: curses.priv.h,v 1.450 2010/01/23 22:05:30 tom Exp $
+ * $Id: curses.priv.h,v 1.451 2010/02/06 19:15:52 tom Exp $
  *
  *     curses.priv.h
  *
@@ -558,6 +558,9 @@ typedef enum {
 #if USE_SYSMOUSE
        ,M_SYSMOUSE             /* FreeBSD sysmouse on console */
 #endif
+#ifdef USE_TERM_DRIVER
+       ,M_TERM_DRIVER          /* Win32 console, etc */
+#endif
 } MouseType;
 
 /*
@@ -1031,6 +1034,13 @@ struct screen {
        int             _sysmouse_new_buttons;
 #endif
 
+#ifdef USE_TERM_DRIVER
+       MEVENT          _drv_mouse_fifo[FIFO_SIZE];
+       int             _drv_mouse_head;
+       int             _drv_mouse_tail;
+       int             _drv_mouse_old_buttons;
+       int             _drv_mouse_new_buttons;
+#endif
        /*
         * This supports automatic resizing
         */
index 78cd8f5089d3c640a5f639f0fbdf64b86137bcbb..5ebc85fab7ad933e17de687e63c1b29e0d7b152f 100644 (file)
  *                                                                          *
  ****************************************************************************/
 
+/*
+ * TODO - GetMousePos(POINT * result) from ntconio.c
+ * TODO - implement nodelay
+ */
+
 #include <curses.priv.h>
 
-MODULE_ID("$Id: win_driver.c,v 1.5 2010/01/16 22:42:30 tom Exp $")
+MODULE_ID("$Id: win_driver.c,v 1.6 2010/02/06 19:55:44 tom Exp $")
 
 #define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE)
 
@@ -411,8 +416,7 @@ drv_sgmode(TERMINAL_CONTROL_BLOCK * TCB, bool setFlag, TTY * buf)
        else
            dwFlag &= ~ENABLE_PROCESSED_INPUT;
 
-       /* we disable that for now to focus on keyboard. */
-       dwFlag &= ~ENABLE_MOUSE_INPUT;
+       dwFlag |= ENABLE_MOUSE_INPUT;
 
        buf->c_iflag = iflag;
        buf->c_lflag = lflag;
@@ -682,6 +686,8 @@ drv_initmouse(TERMINAL_CONTROL_BLOCK * TCB)
 
     AssertTCB();
     SetSP();
+
+    sp->_mouse_type = M_TERM_DRIVER;
 }
 
 static int
@@ -908,6 +914,62 @@ drv_twait(TERMINAL_CONTROL_BLOCK * TCB,
     return code;
 }
 
+#define BUTTON_MASK (FROM_LEFT_1ST_BUTTON_PRESSED | \
+                    FROM_LEFT_2ND_BUTTON_PRESSED | \
+                    FROM_LEFT_3RD_BUTTON_PRESSED)
+
+static bool
+handle_mouse(SCREEN *sp, MOUSE_EVENT_RECORD mer)
+{
+    MEVENT work;
+    bool result = FALSE;
+
+    sp->_drv_mouse_old_buttons = sp->_drv_mouse_new_buttons;
+    sp->_drv_mouse_new_buttons = mer.dwButtonState & BUTTON_MASK;
+
+    /*
+     * We're only interested if the button is pressed or released.
+     * FIXME: implement continuous event-tracking.
+     */
+    if (sp->_drv_mouse_new_buttons != sp->_drv_mouse_old_buttons) {
+
+       memset(&work, 0, sizeof(work));
+
+       if (sp->_drv_mouse_new_buttons) {
+
+           if (sp->_drv_mouse_new_buttons & FROM_LEFT_1ST_BUTTON_PRESSED)
+               work.bstate |= BUTTON1_PRESSED;
+           if (sp->_drv_mouse_new_buttons & FROM_LEFT_2ND_BUTTON_PRESSED)
+               work.bstate |= BUTTON2_PRESSED;
+           if (sp->_drv_mouse_new_buttons & FROM_LEFT_3RD_BUTTON_PRESSED)
+               work.bstate |= BUTTON3_PRESSED;
+           if (sp->_drv_mouse_new_buttons & FROM_LEFT_4TH_BUTTON_PRESSED)
+               work.bstate |= BUTTON4_PRESSED;
+
+       } else {
+
+           if (sp->_drv_mouse_old_buttons & FROM_LEFT_1ST_BUTTON_PRESSED)
+               work.bstate |= BUTTON1_RELEASED;
+           if (sp->_drv_mouse_old_buttons & FROM_LEFT_2ND_BUTTON_PRESSED)
+               work.bstate |= BUTTON2_RELEASED;
+           if (sp->_drv_mouse_old_buttons & FROM_LEFT_3RD_BUTTON_PRESSED)
+               work.bstate |= BUTTON3_RELEASED;
+           if (sp->_drv_mouse_old_buttons & FROM_LEFT_4TH_BUTTON_PRESSED)
+               work.bstate |= BUTTON4_RELEASED;
+
+           result = TRUE;
+       }
+
+       work.x = mer.dwMousePosition.X;
+       work.y = mer.dwMousePosition.Y;
+
+       sp->_drv_mouse_fifo[sp->_drv_mouse_tail] = work;
+       sp->_drv_mouse_tail += 1;
+    }
+
+    return result;
+}
+
 static int
 drv_read(TERMINAL_CONTROL_BLOCK * TCB, int *buf)
 {
@@ -925,6 +987,7 @@ drv_read(TERMINAL_CONTROL_BLOCK * TCB, int *buf)
 
     memset(&inp, 0, sizeof(inp));
 
+    T((T_CALLED("drv_read(%p)"), TCB));
     while ((b = ReadConsoleInput(TCB->inp, &inp, 1, &nRead))) {
        if (b && nRead > 0) {
            if (inp.EventType == KEY_EVENT) {
@@ -945,14 +1008,16 @@ drv_read(TERMINAL_CONTROL_BLOCK * TCB, int *buf)
                } else {        /* *buf != 0 */
                    break;
                }
-           } else if (0 && inp.EventType == MOUSE_EVENT) {
-               *buf = KEY_MOUSE;
-               break;
+           } else if (inp.EventType == MOUSE_EVENT) {
+               if (handle_mouse(sp, inp.Event.MouseEvent)) {
+                   *buf = KEY_MOUSE;
+                   break;
+               }
            }
            continue;
        }
     }
-    return n;
+    returnCode(n);
 }
 
 static int