-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1526 2010/04/03 14:46:26 tom Exp $
+-- $Id: NEWS,v 1.1528 2010/04/10 21:23:37 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
+20100410
+ + improve win_driver.c handling of mouse:
+ + discard motion events
+ + avoid calling _nc_timed_wait when there is a mouse event
+ + handle 4th and "rightmost" buttons.
+ + quote substitutions in CF_RPATH_HACK_2 configure macro, needed for
+ cases where there are embedded blanks in the rpath option.
+
20100403
+ add configure check for exctags vs ctags, to work around pkgsrc.
+ simplify logic in _nc_get_screensize() to make it easier to see how
dnl
dnl Author: Thomas E. Dickey 1995-on
dnl
-dnl $Id: aclocal.m4,v 1.507 2010/04/04 00:07:57 tom Exp $
+dnl $Id: aclocal.m4,v 1.508 2010/04/06 00:03:50 tom Exp $
dnl Macros used in NCURSES auto-configuration script.
dnl
dnl These macros are maintained separately from NCURSES. The copyright on
AC_SUBST(EXTRA_LDFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_RPATH_HACK_2 version: 3 updated: 2010/04/02 20:27:47
+dnl CF_RPATH_HACK_2 version: 4 updated: 2010/04/05 20:03:50
dnl ---------------
dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to
dnl EXTRA_LDFLAGS for each -L option found.
case $cf_rpath_src in #(vi
-L*) #(vi
if test "$LD_RPATH_OPT" = "-R " ; then
- cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e 's%-L%-R %'`
+ cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"`
else
- cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e s%-L%$LD_RPATH_OPT%`
+ cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"`
fi
CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp)
EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
case $cf_rpath_src in #(vi
-L*) #(vi
if test "$LD_RPATH_OPT" = "-R " ; then
- cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e 's%-L%-R %'`
+ cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"`
else
- cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e s%-L%$LD_RPATH_OPT%`
+ cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"`
fi
test -n "$verbose" && echo " ...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6
case $cf_rpath_src in #(vi
-L*) #(vi
if test "$LD_RPATH_OPT" = "-R " ; then
- cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e 's%-L%-R %'`
+ cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"`
else
- cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e s%-L%$LD_RPATH_OPT%`
+ cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"`
fi
test -n "$verbose" && echo " ...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: dist.mk,v 1.753 2010/03/28 19:31:16 tom Exp $
+# $Id: dist.mk,v 1.754 2010/04/06 00:03:50 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 5
NCURSES_MINOR = 7
-NCURSES_PATCH = 20100403
+NCURSES_PATCH = 20100410
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
/****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-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 *
#include <curses.priv.h>
-MODULE_ID("$Id: lib_getch.c,v 1.110 2010/02/06 18:39:16 tom Exp $")
+MODULE_ID("$Id: lib_getch.c,v 1.111 2010/04/10 19:08:59 tom Exp $")
#include <fifo_defs.h>
return (sp ? sp->_use_meta : 0);
}
-#ifdef NCURSES_WGETCH_EVENTS
-#define TWAIT_MASK (TW_ANY | TW_EVENT)
-#else
-#define TWAIT_MASK TW_ANY
-#endif
-
/*
* Check for mouse activity, returning nonzero if we find any.
*/
{
int rc;
+#ifdef USE_TERM_DRIVER
+ rc = TCBOf(sp)->drv->testmouse(TCBOf(sp), delay);
+#else
#if USE_SYSMOUSE
if ((sp->_mouse_type == M_SYSMOUSE)
&& (sp->_sysmouse_head < sp->_sysmouse_tail)) {
- return TW_MOUSE;
- }
-#endif
-#ifdef USE_TERM_DRIVER
- rc = TCBOf(sp)->drv->twait(TCBOf(sp),
- TWAIT_MASK,
- delay,
- (int *) 0
- EVENTLIST_2nd(evl));
-#else
- rc = _nc_timed_wait(sp,
- TWAIT_MASK,
- delay,
- (int *) 0
- EVENTLIST_2nd(evl));
+ rc = TW_MOUSE;
+ } else
#endif
+ {
+ rc = _nc_timed_wait(sp,
+ TWAIT_MASK,
+ delay,
+ (int *) 0
+ EVENTLIST_2nd(evl));
#if USE_SYSMOUSE
- if ((sp->_mouse_type == M_SYSMOUSE)
- && (sp->_sysmouse_head < sp->_sysmouse_tail)
- && (rc == 0)
- && (errno == EINTR)) {
- rc |= TW_MOUSE;
+ if ((sp->_mouse_type == M_SYSMOUSE)
+ && (sp->_sysmouse_head < sp->_sysmouse_tail)
+ && (rc == 0)
+ && (errno == EINTR)) {
+ rc |= TW_MOUSE;
+ }
+#endif
}
#endif
return rc;
/*
- * $Id: curses.priv.h,v 1.457 2010/03/31 23:42:32 tom Exp $
+ * $Id: curses.priv.h,v 1.458 2010/04/10 19:12:32 tom Exp $
*
* curses.priv.h
*
#define EVENTLIST_0th(param) param
#define EVENTLIST_1st(param) param
#define EVENTLIST_2nd(param) , param
+#define TWAIT_MASK (TW_ANY | TW_EVENT)
#else
#define EVENTLIST_0th(param) void
#define EVENTLIST_1st(param) /* nothing */
#define EVENTLIST_2nd(param) /* nothing */
+#define TWAIT_MASK TW_ANY
#endif
#if NCURSES_EXPANDED && NCURSES_EXT_FUNCS
int maxpairs;
int nocolorvideo;
+ int numbuttons;
int numlabels;
int labelwidth;
int labelheight;
void (*initcolor)(struct DriverTCB*,short,short,short,short);
void (*docolor)(struct DriverTCB*,short,short,bool,int(*)(SCREEN*,int));
void (*initmouse)(struct DriverTCB*);
+ int (*testmouse)(struct DriverTCB*,int);
void (*setfilter)(struct DriverTCB*);
void (*hwlabel)(struct DriverTCB*,int,char*);
void (*hwlabelOnOff)(struct DriverTCB*,bool);
# endif
#endif
-MODULE_ID("$Id: tinfo_driver.c,v 1.8 2010/04/03 14:10:56 tom Exp $")
+MODULE_ID("$Id: tinfo_driver.c,v 1.9 2010/04/10 16:11:17 tom Exp $")
/*
* SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS,
}
}
+static int
+drv_testmouse(TERMINAL_CONTROL_BLOCK * TCB, int delay)
+{
+ int rc = 0;
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+#if USE_SYSMOUSE
+ if ((sp->_mouse_type == M_SYSMOUSE)
+ && (sp->_sysmouse_head < sp->_sysmouse_tail)) {
+ rc = TW_MOUSE;
+ } else
+#endif
+ {
+ rc = TCBOf(sp)->drv->twait(TCBOf(sp),
+ TWAIT_MASK,
+ delay,
+ (int *) 0
+ EVENTLIST_2nd(evl));
+#if USE_SYSMOUSE
+ if ((sp->_mouse_type == M_SYSMOUSE)
+ && (sp->_sysmouse_head < sp->_sysmouse_tail)
+ && (rc == 0)
+ && (errno == EINTR)) {
+ rc |= TW_MOUSE;
+ }
+#endif
+ }
+ return rc;
+}
+
static int
drv_mvcur(TERMINAL_CONTROL_BLOCK * TCB, int yold, int xold, int ynew, int xnew)
{
drv_initcolor, /* initcolor */
drv_do_color, /* docolor */
drv_initmouse, /* initmouse */
+ drv_testmouse, /* testmouse */
drv_setfilter, /* setfilter */
drv_hwlabel, /* hwlabel */
drv_hwlabelOnOff, /* hwlabelOnOff */
#include <curses.priv.h>
-MODULE_ID("$Id: win_driver.c,v 1.7 2010/03/31 23:21:39 tom Exp $")
+MODULE_ID("$Id: win_driver.c,v 1.8 2010/04/10 19:42:47 tom Exp $")
#define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE)
static void
drv_init(TERMINAL_CONTROL_BLOCK * TCB)
{
+ DWORD num_buttons;
+
T((T_CALLED("drv_init(%p)"), TCB));
AssertTCB();
TCB->info.nocolorvideo = 1;
TCB->info.tabsize = 8;
+ if (GetNumberOfConsoleMouseButtons(&num_buttons)) {
+ T(("mouse has %ld buttons", num_buttons));
+ TCB->info.numbuttons = num_buttons;
+ } else {
+ TCB->info.numbuttons = 1;
+ }
+
TCB->info.defaultPalette = _nc_cga_palette;
for (i = 0; i < (N_INI + FKEYS); i++) {
sp->_mouse_type = M_TERM_DRIVER;
}
+static int
+drv_testmouse(TERMINAL_CONTROL_BLOCK * TCB, int delay)
+{
+ int rc = 0;
+ SCREEN *sp;
+
+ AssertTCB();
+ SetSP();
+
+ if (sp->_drv_mouse_head < sp->_drv_mouse_tail) {
+ rc = TW_MOUSE;
+ } else {
+ rc = TCBOf(sp)->drv->twait(TCBOf(sp),
+ TWAIT_MASK,
+ delay,
+ (int *) 0
+ EVENTLIST_2nd(evl));
+ }
+
+ return rc;
+}
+
static int
drv_mvcur(TERMINAL_CONTROL_BLOCK * TCB,
int yold GCC_UNUSED, int xold GCC_UNUSED,
return milliseconds;
}
+#define BUTTON_MASK (FROM_LEFT_1ST_BUTTON_PRESSED | \
+ FROM_LEFT_2ND_BUTTON_PRESSED | \
+ FROM_LEFT_3RD_BUTTON_PRESSED | \
+ FROM_LEFT_4TH_BUTTON_PRESSED | \
+ RIGHTMOST_BUTTON_PRESSED)
+
+static int
+decode_mouse(TERMINAL_CONTROL_BLOCK * TCB, int mask)
+{
+ SCREEN *sp;
+ int result = 0;
+
+ AssertTCB();
+ SetSP();
+
+ if (mask & FROM_LEFT_1ST_BUTTON_PRESSED)
+ result |= BUTTON1_PRESSED;
+ if (mask & FROM_LEFT_2ND_BUTTON_PRESSED)
+ result |= BUTTON2_PRESSED;
+ if (mask & FROM_LEFT_3RD_BUTTON_PRESSED)
+ result |= BUTTON3_PRESSED;
+ if (mask & FROM_LEFT_4TH_BUTTON_PRESSED)
+ result |= BUTTON4_PRESSED;
+
+ if (mask & RIGHTMOST_BUTTON_PRESSED) {
+ switch (TCB->info.numbuttons) {
+ case 1:
+ result |= BUTTON1_PRESSED;
+ break;
+ case 2:
+ result |= BUTTON2_PRESSED;
+ break;
+ case 3:
+ result |= BUTTON3_PRESSED;
+ break;
+ case 4:
+ result |= BUTTON4_PRESSED;
+ break;
+ }
+ }
+
+ return result;
+}
+
static int
drv_twait(TERMINAL_CONTROL_BLOCK * TCB,
int mode,
AssertTCB();
SetSP();
+ TR(TRACE_IEVENT, ("start twait: %d milliseconds, mode: %d",
+ milliseconds, mode));
+
if (milliseconds < 0)
milliseconds = INFINITY;
}
continue;
case MOUSE_EVENT:
- if (0 && mode & TW_MOUSE) {
+ if (decode_mouse(TCB,
+ (inp.Event.MouseEvent.dwButtonState
+ & BUTTON_MASK)) == 0) {
+ CONSUME();
+ } else if (mode & TW_MOUSE) {
code = TW_MOUSE;
goto end;
- } else
- continue;
+ }
+ continue;
default:
SetConsoleActiveScreenBuffer(!PropOf(TCB)->progMode ?
TCB->hdl : TCB->out);
}
}
end:
+
+ TR(TRACE_IEVENT, ("end twait: returned %d (%d), remaining time %d msec",
+ code, errno, milliseconds));
+
if (timeleft)
*timeleft = milliseconds;
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)
+handle_mouse(TERMINAL_CONTROL_BLOCK * TCB, MOUSE_EVENT_RECORD mer)
{
+ SCREEN *sp;
MEVENT work;
bool result = FALSE;
+ AssertTCB();
+ SetSP();
+
sp->_drv_mouse_old_buttons = sp->_drv_mouse_new_buttons;
sp->_drv_mouse_new_buttons = mer.dwButtonState & BUTTON_MASK;
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;
+ work.bstate |= decode_mouse(TCB, sp->_drv_mouse_new_buttons);
} 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;
+ /* cf: BUTTON_PRESSED, BUTTON_RELEASED */
+ work.bstate |= (decode_mouse(TCB, sp->_drv_mouse_old_buttons) >> 1);
result = TRUE;
}
break;
}
} else if (inp.EventType == MOUSE_EVENT) {
- if (handle_mouse(sp, inp.Event.MouseEvent)) {
+ if (handle_mouse(TCB, inp.Event.MouseEvent)) {
*buf = KEY_MOUSE;
break;
}
drv_initcolor, /* initcolor */
drv_do_color, /* docolor */
drv_initmouse, /* initmouse */
+ drv_testmouse, /* testmouse */
drv_setfilter, /* setfilter */
drv_hwlabel, /* hwlabel */
drv_hwlabelOnOff, /* hwlabelOnOff */