NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/53733: curses wbkgrnd() doesn't apply new background



>Number:         53733
>Category:       lib
>Synopsis:       curses wbkgrnd() doesn't apply new background
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 18 23:55:00 +0000 2018
>Originator:     Valery Ushakov
>Release:        NetBSD 8.99.19
>Organization:
>Environment:
>Description:
wbkgrnd() does wbkgrndset() and also should apply the new background
to existing contents of the window.  Ours doesn't.

>How-To-Repeat:
#define NCURSES_WIDECHAR 1      /* when compiling against ncurses */
#include <curses.h>

#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>


int
main()
{
    WINDOW *scrw = initscr();
    if (scrw == NULL)
        errx(EXIT_FAILURE, "initscr failed");

    mvaddstr(0, 0, "Hello world\n");
    refresh();
    sleep(1);

    cchar_t bg;
    wgetbkgrnd(stdscr, &bg);

    wchar_t bg_wch;
    attr_t bg_attr;
    short bg_color_pair;
    getcchar(&bg, &bg_wch, &bg_attr, &bg_color_pair, NULL);

    bg_wch = '-';
    setcchar(&bg, &bg_wch, bg_attr, bg_color_pair, NULL);

    bkgrnd(&bg);
    refresh();
    sleep(1);

    endwin();
    return EXIT_SUCCESS;
}

$ cc -o bkgrnd bkgrnd.c -lcurses
$ ./bkgrnd

Compare to devel/ncursesw

$ cc -o bkgrnd -I/usr/pkg/include/ncursesw -I/usr/pkg/include bkgrnd.c -L/usr/pkg/lib -Wl,--rpath=/usr/pkg/lib -lncursesw
$ ./bkgrnd


Ncurses fills the screen with minus signs as expected.


Note that old wbkgd() function does the right thing.

>Fix:



Home | Main Index | Thread Index | Old Index