* authorization. *
****************************************************************************/
/*
- * $Id: movewindow.c,v 1.33 2012/01/15 00:30:35 tom Exp $
+ * $Id: movewindow.c,v 1.38 2012/12/15 18:36:40 tom Exp $
*
* Demonstrate move functions for windows and derived windows from the curses
* library.
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)
{
i = event.y - uli;
j = event.x - ulj;
}
- moved = TRUE;
} else {
beep();
break;
res.x = ulj + j;
return (&res);
}
- i %= si;
- j %= sj;
+
+ if (si <= 0)
+ i = 0;
+ else
+ i %= si;
+
+ if (sj <= 0)
+ j = 0;
+ else
+ j %= sj;
/*
* If the caller can handle continuous movement, return the result.
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;
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();
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';
}