From 76af49c338ca828b39306fcf93c6d49dfaf11dfc Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 28 Sep 2008 01:08:36 +0000 Subject: [PATCH] ncurses 5.6 - patch 20080927 + fix build for --with-dmalloc by workaround for redefinition of strndup between string.h and dmalloc.h + fix build for --disable-sigwinch + add environment variable NCURSES_GPM_TERMS to allow override to use GPM on terminals other than "linux", etc. + disable GPM mouse support when $TERM does not happen to contain "linux", since Gpm_Open() no longer limits its assertion to terminals that it might handle, e.g., within "screen" in xterm. + reset mouse file-descriptor when unloading GPM library (report by Miroslav Lichvar). + fix build for --disable-leaks --enable-widec --with-termlib > patch by Juergen Pfeifer: + use improved initialization for soft-label keys in Ada95 sample code. + discard internal symbol _nc_slk_format (unused since 20080112). + move call of slk_paint_info() from _nc_slk_initialize() to slk_intern_refresh(), improving initialization. --- Ada95/samples/sample.adb | 6 +++--- INSTALL | 5 ++++- NEWS | 20 +++++++++++++++++++- dist.mk | 4 ++-- include/nc_alloc.h | 8 +++++--- man/ncurses.3x | 16 ++++++++++++++-- ncurses/base/lib_freeall.c | 6 ++++-- ncurses/base/lib_mouse.c | 32 +++++++++++++++++++++++--------- ncurses/base/lib_slk.c | 32 +------------------------------- ncurses/base/lib_slkrefr.c | 24 +++++++++++++++++++++++- ncurses/curses.priv.h | 4 ++-- ncurses/tinfo/entries.c | 5 +---- panel/panel.priv.h | 12 ++---------- test/ncurses.c | 4 ++-- 14 files changed, 105 insertions(+), 73 deletions(-) diff --git a/Ada95/samples/sample.adb b/Ada95/samples/sample.adb index 5034e6cd..648036f7 100644 --- a/Ada95/samples/sample.adb +++ b/Ada95/samples/sample.adb @@ -35,8 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control --- $Revision: 1.16 $ --- $Date: 2008/07/26 18:48:46 $ +-- $Revision: 1.17 $ +-- $Date: 2008/09/27 14:42:40 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Text_IO; @@ -191,7 +191,7 @@ package body Sample is Set_Soft_Label_Key_Attributes (Color => Header_Color); -- This propagates the attributes to the label window - Clear_Soft_Label_Keys; Restore_Soft_Label_Keys; + Refresh_Soft_Label_Keys; end if; Init_Keyboard_Handler; diff --git a/INSTALL b/INSTALL index e338dc73..0571e98d 100644 --- a/INSTALL +++ b/INSTALL @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: INSTALL,v 1.129 2008/08/23 20:02:46 tom Exp $ +-- $Id: INSTALL,v 1.130 2008/09/27 22:04:56 tom Exp $ --------------------------------------------------------------------- How to install Ncurses/Terminfo on your system --------------------------------------------------------------------- @@ -605,6 +605,9 @@ SUMMARY OF CONFIGURE OPTIONS: Normally this is the same as the release version; some ports have special requirements for compatibility. + This option does not affect linking with libtool, which uses the + release major/minor numbers. + --with-ada-compiler=CMD Specify the Ada95 compiler command (default "gnatmake") diff --git a/NEWS b/NEWS index c9b0e427..a14e7ed9 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.1297 2008/09/25 23:30:56 tom Exp $ +-- $Id: NEWS,v 1.1302 2008/09/27 22:37:50 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,24 @@ 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. +20080927 + + fix build for --with-dmalloc by workaround for redefinition of + strndup between string.h and dmalloc.h + + fix build for --disable-sigwinch + + add environment variable NCURSES_GPM_TERMS to allow override to use + GPM on terminals other than "linux", etc. + + disable GPM mouse support when $TERM does not happen to contain + "linux", since Gpm_Open() no longer limits its assertion to terminals + that it might handle, e.g., within "screen" in xterm. + + reset mouse file-descriptor when unloading GPM library (report by + Miroslav Lichvar). + + fix build for --disable-leaks --enable-widec --with-termlib + > patch by Juergen Pfeifer: + + use improved initialization for soft-label keys in Ada95 sample code. + + discard internal symbol _nc_slk_format (unused since 20080112). + + move call of slk_paint_info() from _nc_slk_initialize() to + slk_intern_refresh(), improving initialization. + 20080925 + fix bug in mouse code for GPM from 20080920 changes (reported in Debian #500103, also Miroslav Lichvar). diff --git a/dist.mk b/dist.mk index 9d30d2b4..aefa45e9 100644 --- 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.662 2008/09/25 20:12:43 tom Exp $ +# $Id: dist.mk,v 1.663 2008/09/27 12:10: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 = 6 -NCURSES_PATCH = 20080925 +NCURSES_PATCH = 20080927 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/include/nc_alloc.h b/include/nc_alloc.h index 9b5751de..f521bffe 100644 --- a/include/nc_alloc.h +++ b/include/nc_alloc.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2007 Free Software Foundation, Inc. * + * Copyright (c) 1998-2007,2008 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 * @@ -27,9 +27,9 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 1996,1997 * + * Author: Thomas E. Dickey 1996-on * ****************************************************************************/ -/* $Id: nc_alloc.h,v 1.15 2007/02/03 18:40:23 tom Exp $ */ +/* $Id: nc_alloc.h,v 1.16 2008/09/27 22:30:33 tom Exp $ */ #ifndef NC_ALLOC_included #define NC_ALLOC_included 1 @@ -39,6 +39,8 @@ extern "C" { #endif #if HAVE_LIBDMALLOC +#include +#undef strndup /* workaround for #define in GLIBC 2.7 */ #include /* Gray Watson's library */ #else #undef HAVE_LIBDMALLOC diff --git a/man/ncurses.3x b/man/ncurses.3x index ac3d0495..7e337f9d 100644 --- a/man/ncurses.3x +++ b/man/ncurses.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2007,2008 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 * @@ -27,7 +27,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: ncurses.3x,v 1.89 2007/09/01 18:57:29 tom Exp $ +.\" $Id: ncurses.3x,v 1.90 2008/09/27 19:30:39 tom Exp $ .hy 0 .TH ncurses 3X "" .ds n 5 @@ -830,6 +830,18 @@ about the colors, set this to "-1,-1". To make it green-on-black, set it to "2,0". Any positive value from zero to the terminfo \fBmax_colors\fR value is allowed. .TP 5 +NCURSES_GPM_TERMS +This applies only to ncurses configured to use the GPM interface. +.IP +If present, +the environment variable is a list of one or more terminal names +against which the TERM environment variable is matched. +Setting it to an empty value disables the GPM interface; +using the built-in support for xterm, etc. +.IP +If the environment variable is absent, +ncurses will attempt to open GPM if TERM contains "linux". +.TP 5 NCURSES_NO_HARD_TABS \fBNcurses\fP may use tabs as part of the cursor movement optimization. In some cases, diff --git a/ncurses/base/lib_freeall.c b/ncurses/base/lib_freeall.c index e3625a2f..56402658 100644 --- a/ncurses/base/lib_freeall.c +++ b/ncurses/base/lib_freeall.c @@ -40,7 +40,7 @@ extern int malloc_errfd; /* FIXME */ #endif -MODULE_ID("$Id: lib_freeall.c,v 1.53 2008/09/20 18:28:51 tom Exp $") +MODULE_ID("$Id: lib_freeall.c,v 1.54 2008/09/27 13:09:57 tom Exp $") /* * Free all ncurses data. This is used for testing only (there's no practical @@ -105,7 +105,9 @@ _nc_freeall(void) #ifdef TRACE (void) _nc_trace_buf(-1, 0); #endif - +#if USE_WIDEC_SUPPORT + FreeIfNeeded(_nc_wacs); +#endif _nc_leaks_tinfo(); #if HAVE_LIBDBMALLOC diff --git a/ncurses/base/lib_mouse.c b/ncurses/base/lib_mouse.c index 731025e3..16fc0da9 100644 --- a/ncurses/base/lib_mouse.c +++ b/ncurses/base/lib_mouse.c @@ -79,7 +79,7 @@ #include -MODULE_ID("$Id: lib_mouse.c,v 1.99 2008/09/25 21:47:51 tom Exp $") +MODULE_ID("$Id: lib_mouse.c,v 1.101 2008/09/27 19:14:52 tom Exp $") #include #include @@ -365,20 +365,33 @@ enable_xterm_mouse(SCREEN *sp, int enable) } #if USE_GPM_SUPPORT -static int +static bool allow_gpm_mouse(void) { + bool result = FALSE; + /* GPM does printf's without checking if stdout is a terminal */ if (isatty(fileno(stdout))) { + char *list = getenv("NCURSES_GPM_TERMS"); char *env = getenv("TERM"); - /* GPM checks the beginning of the $TERM variable to decide if - * it should pass xterm events through. There is no real advantage - * in allowing GPM to do this. - */ - if (env == 0 || strncmp(env, "xterm", 5)) - return TRUE; + if (list != 0) { + if (env != 0) { + result = _nc_name_match(list, env, "|:"); + } + } else { + /* GPM checks the beginning of the $TERM variable to decide if it + * should pass xterm events through. There is no real advantage in + * allowing GPM to do this. Recent versions relax that check, and + * pretend that GPM can work with any terminal having the kmous + * capability. Perhaps that works for someone. If so, they can + * set the environment variable (above). + */ + if (env != 0 && strstr(env, "linux") != 0) { + result = TRUE; + } + } } - return FALSE; + return result; } #ifdef HAVE_LIBDL @@ -388,6 +401,7 @@ unload_gpm_library(SCREEN *sp) if (SP->_dlopen_gpm != 0) { T(("unload GPM library")); sp->_mouse_gpm_loaded = FALSE; + sp->_mouse_fd = -1; dlclose(sp->_dlopen_gpm); sp->_dlopen_gpm = 0; } diff --git a/ncurses/base/lib_slk.c b/ncurses/base/lib_slk.c index fd5c53e0..662f7e45 100644 --- a/ncurses/base/lib_slk.c +++ b/ncurses/base/lib_slk.c @@ -45,34 +45,7 @@ #include #include /* num_labels, label_*, plab_norm */ -MODULE_ID("$Id: lib_slk.c,v 1.34 2008/08/16 19:20:04 tom Exp $") - -/* - * We'd like to move these into the screen context structure, but cannot, - * because slk_init() is called before initscr()/newterm(). - */ -NCURSES_EXPORT_VAR(int) -_nc_slk_format = 0; /* one more than format specified in slk_init() */ - -/* - * Paint the info line for the PC style SLK emulation. - */ -static void -slk_paint_info(WINDOW *win) -{ - SCREEN *sp = _nc_screen_of(win); - - if (win && sp && (sp->slk_format == 4)) { - int i; - - mvwhline(win, 0, 0, 0, getmaxx(win)); - wmove(win, 0, 0); - - for (i = 0; i < sp->_slk->maxlab; i++) { - mvwprintw(win, 0, sp->_slk->ent[i].ent_x, "F%d", i + 1); - } - } -} +MODULE_ID("$Id: lib_slk.c,v 1.35 2008/09/27 14:07:33 juergen Exp $") /* * Free any memory related to soft labels, return an error. @@ -160,7 +133,6 @@ _nc_slk_initialize(WINDOW *stwin, int cols) x += max_length; x += (i == 3 || i == 7) ? gap : 1; } - slk_paint_info(stwin); } else { if (_nc_globals.slk_format == 2) { /* 4-4 */ int gap = cols - (SP->_slk->maxlab * max_length) - 6; @@ -214,8 +186,6 @@ slk_restore(void) return (ERR); SP->_slk->hidden = FALSE; SP->_slk->dirty = TRUE; - /* we have to repaint info line eventually */ - slk_paint_info(SP->_slk->win); returnCode(slk_refresh()); } diff --git a/ncurses/base/lib_slkrefr.c b/ncurses/base/lib_slkrefr.c index 20a2198e..cb1beba0 100644 --- a/ncurses/base/lib_slkrefr.c +++ b/ncurses/base/lib_slkrefr.c @@ -40,7 +40,27 @@ #include #include /* num_labels, label_*, plab_norm */ -MODULE_ID("$Id: lib_slkrefr.c,v 1.16 2008/08/03 22:40:27 tom Exp $") +MODULE_ID("$Id: lib_slkrefr.c,v 1.17 2008/09/27 14:07:53 juergen Exp $") + +/* + * Paint the info line for the PC style SLK emulation. + */ +static void +slk_paint_info(WINDOW *win) +{ + SCREEN *sp = _nc_screen_of(win); + + if (win && sp && (sp->slk_format == 4)) { + int i; + + mvwhline(win, 0, 0, 0, getmaxx(win)); + wmove(win, 0, 0); + + for (i = 0; i < sp->_slk->maxlab; i++) { + mvwprintw(win, 0, sp->_slk->ent[i].ent_x, "F%d", i + 1); + } + } +} /* * Write the soft labels to the soft-key window. @@ -60,6 +80,8 @@ slk_intern_refresh(SLK * slk) putp(TPARM_2(plab_norm, i + 1, slk->ent[i].form_text)); } } else { + if (fmt == 4) + slk_paint_info(slk->win); wmove(slk->win, SLK_LINES(fmt) - 1, slk->ent[i].ent_x); if (SP->_slk) { wattrset(slk->win, AttrOf(SP->_slk->attr)); diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index a2e8fb22..5175dd7c 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -34,7 +34,7 @@ /* - * $Id: curses.priv.h,v 1.392 2008/09/20 21:14:11 tom Exp $ + * $Id: curses.priv.h,v 1.393 2008/09/27 22:12:07 tom Exp $ * * curses.priv.h * @@ -147,7 +147,7 @@ extern int errno; #define HAVE_SIZECHANGE 0 #endif -#if HAVE_SIZECHANGE && defined(SIGWINCH) +#if HAVE_SIZECHANGE && USE_SIGWINCH && defined(SIGWINCH) #define USE_SIZECHANGE 1 #else #define USE_SIZECHANGE 0 diff --git a/ncurses/tinfo/entries.c b/ncurses/tinfo/entries.c index 0a43a17f..cf2a8337 100644 --- a/ncurses/tinfo/entries.c +++ b/ncurses/tinfo/entries.c @@ -37,7 +37,7 @@ #include #include -MODULE_ID("$Id: entries.c,v 1.7 2008/06/28 23:08:51 tom Exp $") +MODULE_ID("$Id: entries.c,v 1.8 2008/09/27 13:11:10 tom Exp $") /**************************************************************************** * @@ -128,9 +128,6 @@ _nc_leaks_tinfo(void) _nc_codes_leaks(); FreeIfNeeded(_nc_prescreen.real_acs_map); #endif -#if USE_WIDEC_SUPPORT - FreeIfNeeded(_nc_wacs); -#endif if ((s = _nc_home_terminfo()) != 0) free(s); diff --git a/panel/panel.priv.h b/panel/panel.priv.h index 98d741ff..4fb8144e 100644 --- a/panel/panel.priv.h +++ b/panel/panel.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2005 Free Software Foundation, Inc. * + * Copyright (c) 1998-2005,2008 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 * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ -/* $Id: panel.priv.h,v 1.21 2005/11/26 15:27:00 tom Exp $ */ +/* $Id: panel.priv.h,v 1.22 2008/09/27 22:36:11 tom Exp $ */ #ifndef NCURSES_PANEL_PRIV_H #define NCURSES_PANEL_PRIV_H 1 @@ -39,14 +39,6 @@ #include #include -#if HAVE_LIBDMALLOC -# include /* Gray Watson's library */ -#endif - -#if HAVE_LIBDBMALLOC -# include /* Conor Cahill's library */ -#endif - #include "curses.priv.h" #include "panel.h" #include diff --git a/test/ncurses.c b/test/ncurses.c index f1bab0e2..3fd7dfae 100644 --- a/test/ncurses.c +++ b/test/ncurses.c @@ -40,7 +40,7 @@ AUTHOR Author: Eric S. Raymond 1993 Thomas E. Dickey (beginning revision 1.27 in 1996). -$Id: ncurses.c,v 1.328 2008/09/13 18:56:02 tom Exp $ +$Id: ncurses.c,v 1.329 2008/09/27 14:34:58 tom Exp $ ***************************************************************************/ @@ -2513,7 +2513,7 @@ slk_help(void) #if HAVE_SLK_COLOR ,"F/B -- cycle through foreground/background colors" #endif - ,"ESC -- return to main menu" + ,"ESC -- return to main menu" ,"" ,"Note: if activating the soft keys causes your terminal to scroll up" ,"one line, your terminal auto-scrolls when anything is written to the" -- 2.44.0