static void recur_move_window(WINDOW *parent, int dy, int dx) { unsigned n; for (n = 0; n < num_windows; ++n) { if (all_windows[n].parent == parent) { mvwin(all_windows[n].child, dy, dx); recur_move_window(all_windows[n].child, dy, dx); } } }
/* * test mvwin(). */ static bool move_window(WINDOW *win, bool recur) { WINDOW *parent = parent_of(win); bool result = FALSE; if (parent != 0) { bool top = (parent == stdscr); int min_col = top ? COL_MIN : 0; int max_col = top ? COL_MAX : getmaxx(parent); int min_line = top ? LINE_MIN : 0; int max_line = top ? LINE_MAX : getmaxy(parent); PAIR *tmp; bool more; head_line("Select new position for %swindow", top ? "" : "sub"); while ((tmp = selectcell(parent, win, min_line, min_col, max_line, max_col, FALSE, &more)) != 0) { int y0, x0; getbegyx(parent, y0, x0); /* * Moving a subwindow has the effect of moving a viewport around * the screen. The parent window retains the contents of the * subwindow in the original location, but the viewport will show * the contents (again) at the new location. So it will look odd * when testing. */ if (mvwin(win, y0 + tmp->y, x0 + tmp->x) != ERR) { if (recur) { recur_move_window(win, tmp->y, tmp->x); } refresh_all(win); doupdate(); result = TRUE; } else { result = FALSE; } if (!more) break; } } head_line("done"); return result; }
static void recur_move_window(WINDOW *parent, int dy, int dx) { unsigned n; for (n = 0; n < num_windows; ++n) { if (all_windows[n].parent == parent) { int y0, x0; getbegyx(all_windows[n].child, y0, x0); mvwin(all_windows[n].child, y0 + dy, x0 + dx); recur_move_window(all_windows[n].child, dy, dx); } } }