1 /* 2 * Copyright (c) 1981 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)mvwin.c 5.4 (Berkeley) 06/01/90"; 10 #endif /* not lint */ 11 12 # include "curses.ext" 13 14 /* 15 * relocate the starting position of a window 16 * 17 */ 18 19 mvwin(win, by, bx) 20 reg WINDOW *win; 21 reg int by, bx; { 22 23 register WINDOW *orig; 24 register int dy, dx; 25 26 if (by + win->_maxy > LINES || bx + win->_maxx > COLS) 27 return ERR; 28 dy = by - win->_begy; 29 dx = bx - win->_begx; 30 orig = win->_orig; 31 if (orig == NULL) { 32 orig = win; 33 do { 34 win->_begy += dy; 35 win->_begx += dx; 36 _swflags_(win); 37 win = win->_nextp; 38 } while (win != orig); 39 } 40 else { 41 if (by < orig->_begy || win->_maxy + dy > orig->_maxy) 42 return ERR; 43 if (bx < orig->_begx || win->_maxx + dx > orig->_maxx) 44 return ERR; 45 win->_begy = by; 46 win->_begx = bx; 47 _swflags_(win); 48 _set_subwin_(orig, win); 49 } 50 touchwin(win); 51 return OK; 52 } 53