From 879fd5bd9d5139bcf96c9188cbc3858014fceb4d Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 7 Dec 2008 01:42:58 +0000 Subject: [PATCH] ncurses 5.7 - patch 20081206 + move del_curterm() call from _nc_freeall() to _nc_leaks_tinfo() to work for progs/clear, progs/tabs, etc. + correct buffer-size after internal resizing of wide-character set_field_buffer(), broken in 20081018 changes (report by Mike Gran). + add "-i" option to test/filter.c to tell it to use initscr() rather than newterm(), to investigate report on comp.unix.programmer that ncurses would clear the screen in that case (it does not - the issue was xterm's alternate screen feature). + add check in mouse-driver to disable connection if GPM returns a zero, indicating that the connection is closed (Debian #506717, adapted from patch by Samuel Thibault). --- NEWS | 15 +++++++++++++- dist.mk | 4 ++-- form/frm_driver.c | 3 ++- ncurses/base/lib_freeall.c | 4 +--- ncurses/base/lib_mouse.c | 12 ++++++++--- ncurses/tinfo/entries.c | 5 ++++- test/filter.c | 42 ++++++++++++++++++++++++++++++++++---- 7 files changed, 70 insertions(+), 15 deletions(-) diff --git a/NEWS b/NEWS index abb90aac..f58b36c4 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.1330 2008/11/29 21:08:00 tom Exp $ +-- $Id: NEWS,v 1.1334 2008/12/07 00:12:46 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,19 @@ 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. +20081206 + + move del_curterm() call from _nc_freeall() to _nc_leaks_tinfo() to + work for progs/clear, progs/tabs, etc. + + correct buffer-size after internal resizing of wide-character + set_field_buffer(), broken in 20081018 changes (report by Mike Gran). + + add "-i" option to test/filter.c to tell it to use initscr() rather + than newterm(), to investigate report on comp.unix.programmer that + ncurses would clear the screen in that case (it does not - the issue + was xterm's alternate screen feature). + + add check in mouse-driver to disable connection if GPM returns a + zero, indicating that the connection is closed (Debian #506717, + adapted from patch by Samuel Thibault). + 20081129 + improve a workaround in adding wide-characters, when a control character is found. The library (cf: 20040207) uses unctrl() to diff --git a/dist.mk b/dist.mk index c5fb80ce..a758387a 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.674 2008/11/28 16:15:46 tom Exp $ +# $Id: dist.mk,v 1.675 2008/12/06 21:19:42 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 = 20081129 +NCURSES_PATCH = 20081206 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/form/frm_driver.c b/form/frm_driver.c index 94323ed2..e5db6cbc 100644 --- a/form/frm_driver.c +++ b/form/frm_driver.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_driver.c,v 1.88 2008/10/18 16:25:00 tom Exp $") +MODULE_ID("$Id: frm_driver.c,v 1.89 2008/12/06 23:08:12 tom Exp $") /*---------------------------------------------------------------------------- This is the core module of the form library. It contains the majority @@ -4366,6 +4366,7 @@ set_field_buffer(FIELD *field, int buffer, const char *value) delwin(field->working); field->working = newpad(field->drows, field->dcols); } + len = Buffer_Length(field); wclear(field->working); mvwaddstr(field->working, 0, 0, value); diff --git a/ncurses/base/lib_freeall.c b/ncurses/base/lib_freeall.c index 56402658..61991816 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.54 2008/09/27 13:09:57 tom Exp $") +MODULE_ID("$Id: lib_freeall.c,v 1.55 2008/12/06 23:52:29 tom Exp $") /* * Free all ncurses data. This is used for testing only (there's no practical @@ -98,8 +98,6 @@ _nc_freeall(void) delscreen(SP); _nc_unlock_global(curses); } - if (cur_term != 0) - del_curterm(cur_term); (void) _nc_printf_string(0, empty_va); #ifdef TRACE diff --git a/ncurses/base/lib_mouse.c b/ncurses/base/lib_mouse.c index 83f63a00..d19189f7 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.103 2008/11/23 00:11:46 tom Exp $") +MODULE_ID("$Id: lib_mouse.c,v 1.104 2008/11/30 01:37:27 tom Exp $") #include #include @@ -694,11 +694,16 @@ _nc_mouse_event(SCREEN *sp GCC_UNUSED) #if USE_GPM_SUPPORT case M_GPM: - { + if (sp->_mouse_fd >= 0) { /* query server for event, return TRUE if we find one */ Gpm_Event ev; - if (my_Gpm_GetEvent(&ev) == 1) { + switch (my_Gpm_GetEvent(&ev)) { + case 0: + /* Connection closed, drop the mouse. */ + sp->_mouse_fd = -1; + break; + case 1: /* there's only one mouse... */ eventp->id = NORMAL_EVENT; @@ -731,6 +736,7 @@ _nc_mouse_event(SCREEN *sp GCC_UNUSED) /* bump the next-free pointer into the circular list */ sp->_mouse_eventp = eventp = NEXT(eventp); result = TRUE; + break; } } break; diff --git a/ncurses/tinfo/entries.c b/ncurses/tinfo/entries.c index cf2a8337..b7d64de7 100644 --- a/ncurses/tinfo/entries.c +++ b/ncurses/tinfo/entries.c @@ -37,7 +37,7 @@ #include #include -MODULE_ID("$Id: entries.c,v 1.8 2008/09/27 13:11:10 tom Exp $") +MODULE_ID("$Id: entries.c,v 1.10 2008/12/07 00:11:45 tom Exp $") /**************************************************************************** * @@ -117,6 +117,9 @@ _nc_leaks_tinfo(void) T((T_CALLED("_nc_free_tinfo()"))); #if NO_LEAKS + if (cur_term != 0) + del_curterm(cur_term); + _nc_free_tparm(); _nc_tgetent_leaks(); _nc_free_entries(_nc_head); diff --git a/test/filter.c b/test/filter.c index bdcea367..561a35b9 100644 --- a/test/filter.c +++ b/test/filter.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. * + * Copyright (c) 1998-2006,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 * @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey 1998 * - * $Id: filter.c,v 1.11 2006/12/09 16:53:47 tom Exp $ + * $Id: filter.c,v 1.12 2008/12/06 21:59:27 tom Exp $ */ #include @@ -78,16 +78,50 @@ new_command(char *buffer, int length, attr_t underline) return code; } +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: filter [options]" + ,"" + ,"Options:" + ," -i use initscr() rather than newterm()" + }; + unsigned n; + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + ExitProgram(EXIT_FAILURE); +} + int -main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +main(int argc, char *argv[]) { + int ch; char buffer[80]; attr_t underline; + bool i_option = FALSE; setlocale(LC_ALL, ""); + while ((ch = getopt(argc, argv, "i")) != -1) { + switch (ch) { + case 'i': + i_option = TRUE; + break; + default: + usage(); + } + } + + printf("starting filter program using %s...\n", + i_option ? "initscr" : "newterm"); filter(); - (void) newterm((char *) 0, stdout, stdin); + if (i_option) { + initscr(); + } else { + (void) newterm((char *) 0, stdout, stdin); + } cbreak(); keypad(stdscr, TRUE); -- 2.44.0