Subject: lib/17835: libmenu menu_sub refresh loses when sub over libform form.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <rtr@wasabisystems.com>
List: netbsd-bugs
Date: 08/05/2002 10:31:18
>Number:         17835
>Category:       lib
>Synopsis:       libmenu menu_sub refresh loses when sub over libform form.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 04 07:27:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Tyler Retzlaff
>Release:        NetBSD 1.6E
>Organization:
	Disorganization
>Environment:
System: NetBSD elysium 1.6E NetBSD 1.6E (elysium) #0: Thu Aug 1 05:17:32 EST 2002 rtr@elysium:/wasabi/home/netbsd/src/sys/arch/i386/compile/elysium i386
Architecture: i386
Machine: i386
>Description:
	When a menu is displayed over top of a form the menu is not properly
	drawn on screen.  Parts of the underlaying form window shows through
	the menu items whitespace.

>How-To-Repeat:

	Setup stdscr, create a form on a sub_win post the form, create a menu
	on another sub_win post the menu, refresh the menu items will have
	parts of form characters in menu item display.

	Following code does the above.  Input moves program through stages.

#include <form.h>
#include <menu.h>

FORM *form;
MENU *menu;
ITEM *items[11];
FIELD *fields[11];

WINDOW *f_sub, *m_sub;

int
main(int argc, char **argv)
{
        char buf[31];
        int i, rows, cols;

        initscr();
        cbreak();
        noecho();

	/* create form items */
        for (i = 0; i < 10; i++) {
                fields[i] = new_field(1, 10, i / 2, 12 * (i % 2), 0, 0);
                snprintf(buf, 31, "Field %d", i);
                set_field_buffer(fields[i], 0, buf);
        }

	/* create form, create form_sub, post form, refresh form_sub */
        fields[i] = NULL;
        form = new_form(fields);
        scale_form(form, &rows, &cols);
        f_sub = newwin(rows, cols, LINES / 2 - rows / 2, COLS / 2 - cols / 2);
        set_form_sub(form, f_sub);
        post_form(form);
        wrefresh(f_sub);

        getch();

	/* setup menu items, with one long one to make others have whitespace */
        for (i = 0; i < 10; i++) {
                if (i != 5)
                        snprintf(buf, 31, "Item %d", i);
                else
                        strcpy(buf, "A slightly longer item");
                items[i] = new_item(buf, "");
        }


	/* create menu, create menu_sub, post menu, refresh menu_sub */
        items[i] = NULL;
        menu = new_menu(items);
        scale_menu(menu, &rows, &cols);
        m_sub = newwin(rows, cols, LINES / 2 - rows / 2, COLS / 2 - cols / 2);
        set_menu_sub(menu, m_sub);
        post_menu(menu);
        wrefresh(m_sub);

        getch();

        endwin();
}

>Fix:
	A likely work around would be to unpost the form before posting the
	menu.
>Release-Note:
>Audit-Trail:
>Unformatted: