X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fncurses.c;h=91acade3c8daea53b3edaf1c2f0adfd82aa73f3c;hp=863d5660f88b5fb0714b2ab6969bef04e65c176d;hb=8144a95f5729b46a1ad4f4c3c4ba29800304e4c0;hpb=1051e5f924808ea27fcf8f5b624e63d07788b86e diff --git a/test/ncurses.c b/test/ncurses.c index 863d5660..91acade3 100644 --- a/test/ncurses.c +++ b/test/ncurses.c @@ -40,7 +40,7 @@ AUTHOR Author: Eric S. Raymond 1993 Thomas E. Dickey (beginning revision 1.27 in 1996). -$Id: ncurses.c,v 1.288 2007/05/12 23:04:11 tom Exp $ +$Id: ncurses.c,v 1.296 2007/12/29 21:05:43 tom Exp $ ***************************************************************************/ @@ -608,6 +608,20 @@ remember_boxes(unsigned level, WINDOW *txt_win, WINDOW *box_win) winstack[level].frame = box_win; } +#if USE_SOFTKEYS && (NCURSES_VERSION_PATCH < 20071229) +static void +slk_repaint(void) +{ + /* this chunk is now done in resize_term() */ + slk_touch(); + slk_clear(); + slk_noutrefresh(); +} + +#else +#define slk_repaint() /* nothing */ +#endif + /* * For wgetch_test(), we create pairs of windows - one for a box, one for text. * Resize both and paint the box in the parent. @@ -623,12 +637,7 @@ resize_boxes(unsigned level, WINDOW *win) touchwin(stdscr); wnoutrefresh(stdscr); -#if USE_SOFTKEYS - /* FIXME: this chunk should be done in resizeterm() */ - slk_touch(); - slk_clear(); - slk_noutrefresh(); -#endif + slk_repaint(); for (n = 0; n < level; ++n) { wresize(winstack[n].frame, high, wide); @@ -829,6 +838,8 @@ static void getch_test(void) { int delay = begin_getch_test(); + + slk_restore(); wgetch_test(0, stdscr, delay); forget_boxes(); finish_getch_test(); @@ -836,7 +847,7 @@ getch_test(void) #if USE_WIDEC_SUPPORT /* - * For wgetch_test(), we create pairs of windows - one for a box, one for text. + * For wget_wch_test(), we create pairs of windows - one for a box, one for text. * Resize both and paint the box in the parent. */ #ifdef KEY_RESIZE @@ -851,12 +862,7 @@ resize_wide_boxes(unsigned level, WINDOW *win) touchwin(stdscr); wnoutrefresh(stdscr); -#if USE_SOFTKEYS - /* FIXME: this chunk should be done in resizeterm() */ - slk_touch(); - slk_clear(); - slk_noutrefresh(); -#endif + slk_repaint(); for (n = 0; n < level; ++n) { wresize(winstack[n].frame, high, wide); @@ -1044,6 +1050,8 @@ static void get_wch_test(void) { int delay = begin_getch_test(); + + slk_restore(); wget_wch_test(0, stdscr, delay); forget_boxes(); finish_getch_test(); @@ -2515,12 +2523,15 @@ slk_test(void) } break; #endif +#if defined(NCURSES_VERSION) && defined(KEY_RESIZE) && HAVE_WRESIZE + case KEY_RESIZE: + break; +#endif default: beep(); } - } while - ((c = Getchar()) != EOF); + } while (!isQuit(c = Getchar())); done: slk_clear(); @@ -2642,12 +2653,14 @@ wide_slk_test(void) call_slk_color(fg, bg); } break; - +#if defined(NCURSES_VERSION) && defined(KEY_RESIZE) && HAVE_WRESIZE + case KEY_RESIZE: + break; +#endif default: beep(); } - } while - ((c = Getchar()) != EOF); + } while (!isQuit(c = Getchar())); done: slk_clear(); @@ -3379,12 +3392,14 @@ FRAME WINDOW *wind; }; -#if defined(NCURSES_VERSION) && !NCURSES_OPAQUE -#define keypad_active(win) (win)->_use_keypad -#define scroll_active(win) (win)->_scroll +#if defined(NCURSES_VERSION) +#if NCURSES_VERSION_PATCH < 20070331 +#define is_keypad(win) (win)->_use_keypad +#define is_scrollok(win) (win)->_scroll +#endif #else -#define keypad_active(win) FALSE -#define scroll_active(win) FALSE +#define is_keypad(win) FALSE +#define is_scrollok(win) FALSE #endif /* We need to know if these flags are actually set, so don't look in FRAME. @@ -3396,7 +3411,7 @@ HaveKeypad(FRAME * curp) { WINDOW *win = (curp ? curp->wind : stdscr); (void) win; - return keypad_active(win); + return is_keypad(win); } static bool @@ -3404,7 +3419,7 @@ HaveScroll(FRAME * curp) { WINDOW *win = (curp ? curp->wind : stdscr); (void) win; - return scroll_active(win); + return is_scrollok(win); } static void @@ -5403,6 +5418,10 @@ demo_forms(void) int finished = 0, c; unsigned n = 0; +#ifdef NCURSES_MOUSE_VERSION + mousemask(ALL_MOUSE_EVENTS, (mmask_t *) 0); +#endif + move(18, 0); addstr("Defined edit/traversal keys: ^Q/ESC- exit form\n"); addstr("^N -- go to next field ^P -- go to previous field\n"); @@ -5476,6 +5495,10 @@ demo_forms(void) free_fieldtype(fty_passwd); noraw(); nl(); + +#ifdef NCURSES_MOUSE_VERSION + mousemask(ALL_MOUSE_EVENTS, (mmask_t *) 0); +#endif } #endif /* USE_LIBFORM */ @@ -6016,7 +6039,7 @@ rip_footer(WINDOW *win, int cols) wbkgd(win, A_REVERSE); werase(win); wmove(win, 0, 0); - wprintw(win, "footer: %d columns", cols); + wprintw(win, "footer: window %p, %d columns", win, cols); wnoutrefresh(win); return OK; } @@ -6027,7 +6050,7 @@ rip_header(WINDOW *win, int cols) wbkgd(win, A_REVERSE); werase(win); wmove(win, 0, 0); - wprintw(win, "header: %d columns", cols); + wprintw(win, "header: window %p, %d columns", win, cols); wnoutrefresh(win); return OK; } @@ -6166,7 +6189,7 @@ main(int argc, char *argv[]) setlocale(LC_ALL, ""); - while ((c = getopt(argc, argv, "a:de:fhmp:s:t:")) != EOF) { + while ((c = getopt(argc, argv, "a:de:fhmp:s:t:")) != -1) { switch (c) { #ifdef NCURSES_VERSION case 'a':