#include <curses.priv.h>
#include <term.h>
-MODULE_ID("$Id: resizeterm.c,v 1.28 2008/01/06 01:23:36 tom Exp $")
+MODULE_ID("$Id: resizeterm.c,v 1.32 2008/05/03 14:28:55 tom Exp $")
#define stolen_lines (screen_lines - SP->_lines_avail)
_nc_lock_global(windowlist);
_tracef("%s resizing: %2d x %2d (%2d x %2d)", name, LINES, COLS,
screen_lines, screen_columns);
- for (wp = _nc_windows; wp != 0; wp = wp->next) {
+ for (each_window(wp)) {
_tracef(" window %p is %2ld x %2ld at %2ld,%2ld",
&(wp->win),
(long) wp->win._maxy + 1,
ripoff_t *rop;
if (win != 0) {
- for (rop = ripoff_stack; (rop - ripoff_stack) < N_RIPS; rop++) {
+ for (each_ripoff(rop)) {
if (rop->win == win && rop->line != 0) {
result = rop;
break;
ripoff_t *rop;
if (win != 0) {
- for (rop = ripoff_stack; (rop - ripoff_stack) < N_RIPS; rop++) {
+ for (each_ripoff(rop)) {
if (rop->line < 0) {
result -= rop->line;
if (rop->win == win) {
if (cmp != 0) {
WINDOWLIST *wp;
- for (wp = _nc_windows; wp != 0; wp = wp->next) {
+ for (each_window(wp)) {
WINDOW *tst = &(wp->win);
if (tst->_parent == cmp) {
depth = 1 + child_depth(tst);
*/
win->_begy += (ToLines - CurLines);
} else {
- if (myLines == CurLines - stolen
- && ToLines != CurLines)
+ if (myLines == (CurLines - stolen)
+ && ToLines != CurLines) {
myLines = ToLines - stolen;
- else if (myLines == CurLines
- && ToLines != CurLines)
+ } else if (myLines == CurLines
+ && ToLines != CurLines) {
myLines = ToLines;
+ }
}
- if (myLines > ToLines)
+ if (myLines > ToLines) {
myLines = ToLines;
+ }
if (myCols > ToCols)
myCols = ToCols;
- if (myLines == CurLines
- && ToLines != CurLines)
- myLines = ToLines;
-
if (myCols == CurCols
&& ToCols != CurCols)
myCols = ToCols;
found = FALSE;
TR(TRACE_UPDATE, ("decreasing size of windows to %dx%d, depth=%d",
ToLines, ToCols, depth));
- for (wp = _nc_windows; wp != 0; wp = wp->next) {
+ for (each_window(wp)) {
WINDOW *win = &(wp->win);
if (!(win->_flags & _ISPAD)) {
found = FALSE;
TR(TRACE_UPDATE, ("increasing size of windows to %dx%d, depth=%d",
ToLines, ToCols, depth));
- for (wp = _nc_windows; wp != 0; wp = wp->next) {
+ for (each_window(wp)) {
WINDOW *win = &(wp->win);
if (!(win->_flags & _ISPAD)) {
/* ripped-off lines are a special case: if we did not lengthen
* them, we haven't moved them either. repaint them, too.
+ *
+ * for the rest - stdscr and other windows - the client has to
+ * decide which to repaint, since without panels, ncurses does
+ * not know which are really on top.
*/
- for (rop = ripoff_stack; (rop - ripoff_stack) < N_RIPS; rop++) {
+ for (each_ripoff(rop)) {
if (rop->win != stdscr
&& rop->win != 0
&& rop->line < 0) {