bug-ncurses
[Top][All Lists]
Advanced

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

bug: curses vs. ncurses: bkgd and subwindows


From: Neil Zanella
Subject: bug: curses vs. ncurses: bkgd and subwindows
Date: Sat, 4 Nov 2000 04:22:36 -0330 (NST)

Hello,

While looking at subwindows I found that curses and ncurses differ in the
way they deal with bkgd() and subwindows. The following program will
cause different output on Solaris curses than on Linux with ncurses.
The differing output is due to strategically positioned calls of bkgd()
on w0 and w3. Moving those calls to another location may yet change 
things once again.

Best Regards,

Neil

#include <curses.h>

int main()
{
   WINDOW *guide, *w;
   WINDOW *w0, *w1, *w2, *w3;
   WINDOW *w00, *w01, *w02, *w03;
   WINDOW *w10, *w11, *w12, *w13;
   WINDOW *w20, *w21, *w22, *w23;
   WINDOW *w30, *w31, *w32, *w33;

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

   guide = subwin(stdscr, 4, 80, 0, 0);
   w = subwin(stdscr, 20, 80, 4, 0);

   w0 = subwin(stdscr, 10, 40,  4,  0);
   w1 = subwin(stdscr, 10, 40,  4, 40);
   w2 = subwin(stdscr, 10, 40, 14,  0);
   w3 = subwin(stdscr, 10, 40, 14, 40);

   w00 = derwin(w0, 5, 20, 0,  0);
   w01 = derwin(w0, 5, 20, 0, 20);
   w02 = derwin(w0, 5, 20, 5,  0);
   w03 = derwin(w0, 5, 20, 5, 20);

   w10 = derwin(w1, 5, 20, 0,  0);
   w11 = derwin(w1, 5, 20, 0, 20);
   w12 = derwin(w1, 5, 20, 5,  0);
   w13 = derwin(w1, 5, 20, 5, 20);

   w20 = derwin(w2, 5, 20, 0,  0);
   w21 = derwin(w2, 5, 20, 0, 20);
   w22 = derwin(w2, 5, 20, 5,  0);
   w23 = derwin(w2, 5, 20, 5, 20);

   w30 = derwin(w3, 5, 20, 0,  0);
   w31 = derwin(w3, 5, 20, 0, 20);
   w32 = derwin(w3, 5, 20, 5,  0);
   w33 = derwin(w3, 5, 20, 5, 20);

   wbkgd(w0, A_REVERSE | 'A');
   wbkgd(w1, A_NORMAL  | 'B');
   wbkgd(w2, A_NORMAL  | 'C');
   wbkgd(w3, A_REVERSE | 'D');

   wbkgd(w00, A_REVERSE | 'E');
   wbkgd(w01, A_NORMAL  | 'F');
   wbkgd(w02, A_NORMAL  | 'G');
   wbkgd(w03, A_REVERSE | 'H');

   wbkgd(w10, A_REVERSE | 'I');
   wbkgd(w11, A_NORMAL  | 'J');
   wbkgd(w12, A_NORMAL  | 'K');
   wbkgd(w13, A_REVERSE | 'L');

   wbkgd(w20, A_REVERSE | 'M');
   wbkgd(w21, A_NORMAL  | 'N');
   wbkgd(w22, A_NORMAL  | 'O');
   wbkgd(w23, A_REVERSE | 'P');

   wbkgd(w30, A_REVERSE | 'Q');
   wbkgd(w31, A_NORMAL  | 'R');
   wbkgd(w32, A_NORMAL  | 'S');
   wbkgd(w33, A_REVERSE | 'T');

   waddstr(guide, "Below these 4 lines lie subwindows w containing\n");
   waddstr(guide, "windows w0, w1, w2, w3 containing\n");
   waddstr(guide, "windows w00, w01, w02, w03, ..., w30, w31, w32, w33.\n");
   waddstr(guide, "We will now refresh the smallest ones by one...");
   waddstr(guide, " (just hit enter 16 times)");
   wgetch(guide);

   wrefresh(w00); wgetch(guide);
   wrefresh(w01); wgetch(guide);
   wrefresh(w02); wgetch(guide);
   wrefresh(w03); wgetch(guide);

   wrefresh(w10); wgetch(guide);
   wrefresh(w11); wgetch(guide);
   wrefresh(w12); wgetch(guide);
   wrefresh(w13); wgetch(guide);

   wrefresh(w20); wgetch(guide);
   wrefresh(w21); wgetch(guide);
   wrefresh(w22); wgetch(guide);
   wrefresh(w23); wgetch(guide);

   wrefresh(w30); wgetch(guide);
   wrefresh(w31); wgetch(guide);
   wrefresh(w32); wgetch(guide);
   wrefresh(w33);

   wclear(guide);
   waddstr(guide, "Press any key to exit");
   wgetch(guide);

   endwin();
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]