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