NetBSD Problem Report #47402

From www@NetBSD.org  Fri Jan  4 01:23:45 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id AB33263E615
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  4 Jan 2013 01:23:45 +0000 (UTC)
Message-Id: <20130104012344.C721E63E615@www.NetBSD.org>
Date: Fri,  4 Jan 2013 01:23:44 +0000 (UTC)
From: gnrp@komkon2.de
Reply-To: gnrp@komkon2.de
To: gnats-bugs@NetBSD.org
Subject: wresize(3) loses window colour attributes
X-Send-Pr-Version: www-1.0

>Number:         47402
>Category:       lib
>Synopsis:       wresize(3) loses window colour attributes
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 04 01:25:00 +0000 2013
>Last-Modified:  Thu Apr 09 02:05:57 +0000 2020
>Originator:     Julian Fagir
>Release:        6.0-RELEASE
>Organization:
>Environment:
>Description:
When you set a colour with wattron and wbkgd and then resize the
window with wresize, it loses its colour, you have to re-set it.
This behaviour is different in nbcurses to ncurses, which holds the
colour. If this is meant by the sentence "The application must redraw
the window after it has been resized.", it should be clarified more.
Anyway, it is an incompatibility with ncurses.
So fixing or documenting this, which is the way to go?
>How-To-Repeat:
Compile the following code with `-lcurses`. Run it on ncurses and see
a shiny white-on-blue screen. Run it with nbcurses and see a
not-so-shiny blue screen with a large black window in it.



#include <curses.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>

int
main(int arg, char *argv[])
{
        int ch, j, i = 0;
        WINDOW *mainwin;

        initscr();
        keypad(stdscr, TRUE);
        noecho();
        cbreak();

        mainwin = newwin(20, 70, 2, 2);
        keypad(mainwin, TRUE);
        box(mainwin, 0, 0);
        mvwprintw(mainwin, 1, 1, "Creating window...");
        wrefresh(mainwin);

        start_color();
        init_pair(1, COLOR_WHITE, COLOR_BLUE);
        attron(COLOR_PAIR(1));
        bkgd(COLOR_PAIR(1));
        wattron(mainwin, COLOR_PAIR(1));
        wbkgd(mainwin, COLOR_PAIR(1));
        wborder(mainwin, 0, 0, 0, 0, 0, 0, 0, 0);
        mvwin(mainwin, 2, 2);
        wresize(mainwin, 20, 70);

        refresh();
        wrefresh(mainwin);
        endwin();

        return 0;
}
>Fix:

>Release-Note:

>Audit-Trail:
From: Julian Coleman <jdc@coris.org.uk>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: lib/47402: wresize(3) loses window colour attributes
Date: Fri, 4 Jan 2013 16:46:31 +0000

 Hi,

 > This behaviour is different in nbcurses to ncurses, which holds the
 > colour. If this is meant by the sentence "The application must
 > redraw the window after it has been resized.", it should be
 > clarified more.
 > Anyway, it is an incompatibility with ncurses.
 > So fixing or documenting this, which is the way to go?

 The current code resizes the window but does not retain the contents (not
 just colours).  On reflection, this is less useful behaviour and copying
 any contents that still fit would be more sensible.

 Thanks,

 J

 -- 
    NetBSD: simple; works; documented    /        Sailing at Newbiggin
         http://www.netbsd.org/        /   http://www.newbigginsailingclub.org/

From: David Laight <david@l8s.co.uk>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: lib/47402: wresize(3) loses window colour attributes
Date: Fri, 4 Jan 2013 17:51:55 +0000

 On Fri, Jan 04, 2013 at 04:50:05PM +0000, Julian Coleman wrote:
 > The following reply was made to PR lib/47402; it has been noted by GNATS.
 >  
 >  The current code resizes the window but does not retain the contents (not
 >  just colours).

 Traditionally curses programs would redraw the screen in the SIGWINCH
 handler (and screw up big-time if the signal interrupted a curses
 function).

 	David

 -- 
 David Laight: david@l8s.co.uk

From: Brett Lymn <blymn@internode.on.net>
To: gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org, gnrp@komkon2.de
Subject: Re: lib/47402: wresize(3) loses window colour attributes
Date: Sun, 6 Jan 2013 20:58:27 +1030

 On Fri, Jan 04, 2013 at 04:50:05PM +0000, Julian Coleman wrote:
 >  
 >  > This behaviour is different in nbcurses to ncurses, which holds
 >  > the colour. If this is meant by the sentence "The application
 >  > must redraw the window after it has been resized.", it should be
 >  > clarified more.
 >  > Anyway, it is an incompatibility with ncurses.
 >  > So fixing or documenting this, which is the way to go?
 >  
 >  The current code resizes the window but does not retain the contents (not
 >  just colours).  On reflection, this is less useful behaviour and copying
 >  any contents that still fit would be more sensible.
 >  

 Losing the contents is OK in my opinion, losing the background attribute
 is not bkgd is supposed to set the window background rendition, this
 should not be reset on resize.

 -- 
 Brett Lymn
 Staple Guns: because duct tape doesn't make that KerCHUNK sound - xkcd.com

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.