Commit | Line | Data |
---|---|---|
87c6fcf8 | 1 | /* |
2f14f200 KB |
2 | * Copyright (c) 1981 Regents of the University of California. |
3 | * All rights reserved. | |
4 | * | |
5 | * Redistribution and use in source and binary forms are permitted | |
a399f6c8 KB |
6 | * provided that the above copyright notice and this paragraph are |
7 | * duplicated in all such forms and that any documentation, | |
8 | * advertising materials, and other materials related to such | |
9 | * distribution and use acknowledge that the software was developed | |
10 | * by the University of California, Berkeley. The name of the | |
11 | * University may not be used to endorse or promote products derived | |
12 | * from this software without specific prior written permission. | |
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
15 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
87c6fcf8 DF |
16 | */ |
17 | ||
18 | #ifndef lint | |
a399f6c8 | 19 | static char sccsid[] = "@(#)touchwin.c 5.3 (Berkeley) %G%"; |
2f14f200 | 20 | #endif /* not lint */ |
87c6fcf8 | 21 | |
ce69801e KA |
22 | # include "curses.ext" |
23 | ||
24 | /* | |
25 | * make it look like the whole window has been changed. | |
26 | * | |
ce69801e KA |
27 | */ |
28 | touchwin(win) | |
ee79d1a2 | 29 | register WINDOW *win; |
ce69801e | 30 | { |
ee79d1a2 | 31 | register int y, maxy; |
60d72089 | 32 | |
ee79d1a2 JB |
33 | # ifdef DEBUG |
34 | fprintf(outf, "TOUCHWIN(%0.2o)\n", win); | |
35 | # endif | |
36 | maxy = win->_maxy; | |
37 | for (y = 0; y < maxy; y++) | |
38 | touchline(win, y, 0, win->_maxx - 1); | |
60d72089 KA |
39 | } |
40 | ||
41 | /* | |
ee79d1a2 | 42 | * touch a given line |
60d72089 | 43 | */ |
ee79d1a2 JB |
44 | touchline(win, y, sx, ex) |
45 | register WINDOW *win; | |
46 | register int y, sx, ex; | |
47 | { | |
48 | # ifdef DEBUG | |
49 | fprintf(outf, "TOUCHLINE(%0.2o, %d, %d, %d)\n", win, y, sx, ex); | |
50 | fprintf(outf, "TOUCHLINE:first = %d, last = %d\n", win->_firstch[y], win->_lastch[y]); | |
51 | # endif | |
52 | sx += win->_ch_off; | |
53 | ex += win->_ch_off; | |
54 | if (win->_firstch[y] == _NOCHANGE) { | |
55 | win->_firstch[y] = sx; | |
56 | win->_lastch[y] = ex; | |
57 | } | |
58 | else { | |
59 | if (win->_firstch[y] > sx) | |
60 | win->_firstch[y] = sx; | |
61 | if (win->_lastch[y] < ex) | |
62 | win->_lastch[y] = ex; | |
ce69801e | 63 | } |
ee79d1a2 JB |
64 | # ifdef DEBUG |
65 | fprintf(outf, "TOUCHLINE:first = %d, last = %d\n", win->_firstch[y], win->_lastch[y]); | |
66 | # endif | |
ce69801e | 67 | } |