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[] = "@(#)touchwin.c 5.6 (Berkeley) 09/14/92"; 10 #endif /* not lint */ 11 12 #include <curses.h> 13 14 /* 15 * touchwin -- 16 * Make it look like the whole window has been changed. 17 */ 18 int 19 touchwin(win) 20 register WINDOW *win; 21 { 22 register int y, maxy; 23 24 #ifdef DEBUG 25 __TRACE("touchwin: (%0.2o)\n", win); 26 #endif 27 maxy = win->maxy; 28 for (y = 0; y < maxy; y++) 29 touchline(win, y, 0, win->maxx - 1); 30 return (OK); 31 } 32 33 /* 34 * touchline -- 35 * Touch a given line. 36 */ 37 int 38 touchline(win, y, sx, ex) 39 register WINDOW *win; 40 register int y, sx, ex; 41 { 42 #ifdef DEBUG 43 __TRACE("touchline: (%0.2o, %d, %d, %d)\n", win, y, sx, ex); 44 __TRACE("touchline: first = %d, last = %d\n", 45 win->lines[y]->firstch, win->lines[y]->lastch); 46 #endif 47 sx += win->ch_off; 48 ex += win->ch_off; 49 if (!(win->lines[y]->flags & __ISDIRTY)) { 50 win->lines[y]->flags |= __ISDIRTY; 51 win->lines[y]->firstch = sx; 52 win->lines[y]->lastch = ex; 53 } else { 54 if (win->lines[y]->firstch > sx) 55 win->lines[y]->firstch = sx; 56 if (win->lines[y]->lastch < ex) 57 win->lines[y]->lastch = ex; 58 } 59 #ifdef DEBUG 60 __TRACE("touchline: first = %d, last = %d\n", 61 win->lines[y]->firstch, win->lines[y]->lastch); 62 #endif 63 return (OK); 64 } 65