]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/movewindow.c
ncurses 5.9 - patch 20121208
[ncurses.git] / test / movewindow.c
index 8fc0a716882b9e2b4a6ae2fcd7e3a70e1cff0015..11521a0722388bc06fd9bbe728eb9d5d7915a3ce 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: movewindow.c,v 1.33 2012/01/15 00:30:35 tom Exp $
+ * $Id: movewindow.c,v 1.37 2012/10/27 19:37:56 tom Exp $
  *
  * Demonstrate move functions for windows and derived windows from the curses
  * library.
@@ -79,6 +79,14 @@ static void tail_line(CONST_FMT char *fmt,...) GCC_PRINTFLIKE(1, 2);
 static unsigned num_windows;
 static FRAME *all_windows;
 
+static void
+failed(const char *s)
+{
+    perror(s);
+    endwin();
+    ExitProgram(EXIT_FAILURE);
+}
+
 static void
 message(int lineno, CONST_FMT char *fmt, va_list argp)
 {
@@ -198,7 +206,6 @@ selectcell(WINDOW *parent,
                        i = event.y - uli;
                        j = event.x - ulj;
                    }
-                   moved = TRUE;
                } else {
                    beep();
                    break;
@@ -306,6 +313,8 @@ add_window(WINDOW *parent, WINDOW *child)
     keypad(child, TRUE);
     if (need > have) {
        all_windows = typeRealloc(FRAME, need, all_windows);
+       if (!all_windows)
+           failed("add_window");
     }
     all_windows[num_windows].parent = parent;
     all_windows[num_windows].child = child;
@@ -492,9 +501,6 @@ move_derwin(WINDOW *win)
                                     max_line, max_col,
                                     TRUE,
                                     &more)) != 0) {
-               int y0, x0;
-
-               getbegyx(parent, y0, x0);
                if (mvderwin(win, tmp->y, tmp->x) != ERR) {
                    refresh_all(win);
                    doupdate();
@@ -545,7 +551,7 @@ fill_with_pattern(WINDOW *win)
     getmaxyx(win, y1, x1);
     for (y = 0; y < y1; ++y) {
        for (x = 0; x < x1; ++x) {
-           MvWAddCh(win, y, x, ch);
+           MvWAddCh(win, y, x, (chtype) ch);
            if (++ch > 'z')
                ch = 'a';
        }