1 /* Public Domain Curses */
5 RCSID("$Id: touch.c,v 1.29 2008/07/13 16:08:18 wmcbrine Exp $")
7 /*man-start**************************************************************
12 int touchwin(WINDOW *win);
13 int touchline(WINDOW *win, int start, int count);
14 int untouchwin(WINDOW *win);
15 int wtouchln(WINDOW *win, int y, int n, int changed);
16 bool is_linetouched(WINDOW *win, int line);
17 bool is_wintouched(WINDOW *win);
20 touchwin() and touchline() throw away all information about
21 which parts of the window have been touched, pretending that the
22 entire window has been drawn on. This is sometimes necessary
23 when using overlapping windows, since a change to one window
24 will affect the other window, but the records of which lines
25 have been changed in the other window will not reflect the
28 untouchwin() marks all lines in the window as unchanged since
29 the last call to wrefresh().
31 wtouchln() makes n lines in the window, starting at line y, look
32 as if they have (changed == 1) or have not (changed == 0) been
33 changed since the last call to wrefresh().
35 is_linetouched() returns TRUE if the specified line in the
36 specified window has been changed since the last call to
39 is_wintouched() returns TRUE if the specified window
40 has been changed since the last call to wrefresh().
43 All functions return OK on success and ERR on error except
44 is_wintouched() and is_linetouched().
46 Portability X/Open BSD SYS V
51 is_linetouched Y - 4.0
54 **man-end****************************************************************/
56 int touchwin(WINDOW
*win
)
60 PDC_LOG(("touchwin() - called: Win=%x\n", win
));
65 for (i
= 0; i
< win
->_maxy
; i
++)
68 win
->_lastch
[i
] = win
->_maxx
- 1;
74 int touchline(WINDOW
*win
, int start
, int count
)
78 PDC_LOG(("touchline() - called: win=%p start %d count %d\n",
81 if (!win
|| start
> win
->_maxy
|| start
+ count
> win
->_maxy
)
84 for (i
= start
; i
< start
+ count
; i
++)
87 win
->_lastch
[i
] = win
->_maxx
- 1;
93 int untouchwin(WINDOW
*win
)
97 PDC_LOG(("untouchwin() - called: win=%p", win
));
102 for (i
= 0; i
< win
->_maxy
; i
++)
104 win
->_firstch
[i
] = _NO_CHANGE
;
105 win
->_lastch
[i
] = _NO_CHANGE
;
111 int wtouchln(WINDOW
*win
, int y
, int n
, int changed
)
115 PDC_LOG(("wtouchln() - called: win=%p y=%d n=%d changed=%d\n",
116 win
, y
, n
, changed
));
118 if (!win
|| y
> win
->_maxy
|| y
+ n
> win
->_maxy
)
121 for (i
= y
; i
< y
+ n
; i
++)
125 win
->_firstch
[i
] = 0;
126 win
->_lastch
[i
] = win
->_maxx
- 1;
130 win
->_firstch
[i
] = _NO_CHANGE
;
131 win
->_lastch
[i
] = _NO_CHANGE
;
138 bool is_linetouched(WINDOW
*win
, int line
)
140 PDC_LOG(("is_linetouched() - called: win=%p line=%d\n", win
, line
));
142 if (!win
|| line
> win
->_maxy
|| line
< 0)
145 return (win
->_firstch
[line
] != _NO_CHANGE
) ? TRUE
: FALSE
;
148 bool is_wintouched(WINDOW
*win
)
152 PDC_LOG(("is_wintouched() - called: win=%p\n", win
));
155 for (i
= 0; i
< win
->_maxy
; i
++)
156 if (win
->_firstch
[i
] != _NO_CHANGE
)