1 /* 2 * Copyright (c) 1981, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)touchwin.c 8.1 (Berkeley) 06/04/93"; 10 #endif /* not lint */ 11 12 #include <curses.h> 13 14 15 /* 16 * touchline -- 17 * Touch a given line. 18 */ 19 int 20 touchline(win, y, sx, ex) 21 WINDOW *win; 22 register int y, sx, ex; 23 { 24 return (__touchline(win, y, sx, ex, 1)); 25 } 26 27 28 /* 29 * touchwin -- 30 * Make it look like the whole window has been changed. 31 */ 32 int 33 touchwin(win) 34 register WINDOW *win; 35 { 36 register int y, maxy; 37 38 #ifdef DEBUG 39 __CTRACE("touchwin: (%0.2o)\n", win); 40 #endif 41 maxy = win->maxy; 42 for (y = 0; y < maxy; y++) 43 __touchline(win, y, 0, win->maxx - 1, 1); 44 return (OK); 45 } 46 47 48 int 49 __touchwin(win) 50 register WINDOW *win; 51 { 52 register int y, maxy; 53 54 #ifdef DEBUG 55 __CTRACE("touchwin: (%0.2o)\n", win); 56 #endif 57 maxy = win->maxy; 58 for (y = 0; y < maxy; y++) 59 __touchline(win, y, 0, win->maxx - 1, 0); 60 return (OK); 61 } 62 63 int 64 __touchline(win, y, sx, ex, force) 65 register WINDOW *win; 66 register int y, sx, ex; 67 int force; 68 { 69 #ifdef DEBUG 70 __CTRACE("touchline: (%0.2o, %d, %d, %d, %d)\n", win, y, sx, ex, force); 71 __CTRACE("touchline: first = %d, last = %d\n", 72 *win->lines[y]->firstchp, *win->lines[y]->lastchp); 73 #endif 74 if (force) 75 win->lines[y]->flags |= __FORCEPAINT; 76 sx += win->ch_off; 77 ex += win->ch_off; 78 if (!(win->lines[y]->flags & __ISDIRTY)) { 79 win->lines[y]->flags |= __ISDIRTY; 80 *win->lines[y]->firstchp = sx; 81 *win->lines[y]->lastchp = ex; 82 } else { 83 if (*win->lines[y]->firstchp > sx) 84 *win->lines[y]->firstchp = sx; 85 if (*win->lines[y]->lastchp < ex) 86 *win->lines[y]->lastchp = ex; 87 } 88 #ifdef DEBUG 89 __CTRACE("touchline: first = %d, last = %d\n", 90 *win->lines[y]->firstchp, *win->lines[y]->lastchp); 91 #endif 92 return (OK); 93 } 94 95 96