A window created with subwin/derwin doesn't draw (even calling touchwin before) when calling wrefresh. I don't know if it could be a bug or no, but, on ncurses it worked fine.
Davi R. Tavares
An example of the problem...
Logged In: YES
It does draw -- in the example program, try printing some text to w1 before the refresh. It seems to be wbkgd() that's behaving differently. I'll look into it further.
P.S. For now, a "werase(w1)" before the refresh will help.
OK, if you move the wbkgd() call for w2 to before the derwin() call, you'll get the effect you want, without having to call werase().
What's happening here is that wbkgd() only changes the attributes for cells that already have the old background attribute. At the time of the derwin() call in test.c, the background for w2 is still 0; so when wbkgd() is called for w1, it compares against 0, finds that the cells aren't that color, and doesn't recolor them.
ncurses, on the other hand, recolors all the cells, not just the cells that match the background. According to my reading of the X/Open standard, that's actually the correct behavior. I ran into this shortly after I took over PDCurses, but at that time, I decided _not_ to fix it, because I liked PDCurses' behavior better. It's the only time I've done that, and I may have to revisit that decision.
My reading of the Solaris source code seems to indicate the same behavior, although I can't test it at the moment.