| 1 | # include "curses.ext" |
| 2 | |
| 3 | /* |
| 4 | * make it look like the whole window has been changed. |
| 5 | * |
| 6 | * @(#)touchwin.c 1.3 (Berkeley) %G% |
| 7 | */ |
| 8 | touchwin(win) |
| 9 | register WINDOW *win; |
| 10 | { |
| 11 | register int y, maxy; |
| 12 | |
| 13 | # ifdef DEBUG |
| 14 | fprintf(outf, "TOUCHWIN(%0.2o)\n", win); |
| 15 | # endif |
| 16 | maxy = win->_maxy; |
| 17 | for (y = 0; y < maxy; y++) |
| 18 | touchline(win, y, 0, win->_maxx - 1); |
| 19 | } |
| 20 | |
| 21 | /* |
| 22 | * touch a given line |
| 23 | */ |
| 24 | touchline(win, y, sx, ex) |
| 25 | register WINDOW *win; |
| 26 | register int y, sx, ex; |
| 27 | { |
| 28 | # ifdef DEBUG |
| 29 | fprintf(outf, "TOUCHLINE(%0.2o, %d, %d, %d)\n", win, y, sx, ex); |
| 30 | fprintf(outf, "TOUCHLINE:first = %d, last = %d\n", win->_firstch[y], win->_lastch[y]); |
| 31 | # endif |
| 32 | sx += win->_ch_off; |
| 33 | ex += win->_ch_off; |
| 34 | if (win->_firstch[y] == _NOCHANGE) { |
| 35 | win->_firstch[y] = sx; |
| 36 | win->_lastch[y] = ex; |
| 37 | } |
| 38 | else { |
| 39 | if (win->_firstch[y] > sx) |
| 40 | win->_firstch[y] = sx; |
| 41 | if (win->_lastch[y] < ex) |
| 42 | win->_lastch[y] = ex; |
| 43 | } |
| 44 | # ifdef DEBUG |
| 45 | fprintf(outf, "TOUCHLINE:first = %d, last = %d\n", win->_firstch[y], win->_lastch[y]); |
| 46 | # endif |
| 47 | } |