]> ncurses.scripts.mit.edu Git - ncurses.git/blob - lib_touch.c
82ef92c5c437098aa725d788439333acad5f93d6
[ncurses.git] / lib_touch.c
1
2 /***************************************************************************
3 *                            COPYRIGHT NOTICE                              *
4 ****************************************************************************
5 *                ncurses is copyright (C) 1992-1995                        *
6 *                          Zeyd M. Ben-Halim                               *
7 *                          zmbenhal@netcom.com                             *
8 *                          Eric S. Raymond                                 *
9 *                          esr@snark.thyrsus.com                           *
10 *                                                                          *
11 *        Permission is hereby granted to reproduce and distribute ncurses  *
12 *        by any means and for any fee, whether alone or as part of a       *
13 *        larger distribution, in source or in binary form, PROVIDED        *
14 *        this notice is included with any such distribution, and is not    *
15 *        removed from any of its header files. Mention of ncurses in any   *
16 *        applications linked with it is highly appreciated.                *
17 *                                                                          *
18 *        ncurses comes AS IS with no warranty, implied or expressed.       *
19 *                                                                          *
20 ***************************************************************************/
21
22 /*
23 **      lib_touch.c
24 **
25 **         The routines untouchwin(),
26 **                      wtouchln(),
27 **                      is_linetouched()
28 **                      is_wintouched().
29 **
30 */
31
32 #include <curses.priv.h>
33
34 MODULE_ID("$Id: lib_touch.c,v 1.3 1997/02/02 00:26:15 tom Exp $")
35
36 int is_linetouched(WINDOW *win, int line)
37 {
38         T((T_CALLED("is_linetouched(%p,%d)"), win, line));
39
40         /* XSI doesn't define any error */
41         if (line > win->_maxy || line < 0)
42                 returnCode(ERR);
43
44         returnCode(win->_line[line].firstchar != _NOCHANGE ? TRUE : FALSE);
45 }
46
47 int is_wintouched(WINDOW *win)
48 {
49 int i;
50
51         T((T_CALLED("is_wintouched(%p)"), win));
52
53         for (i = 0; i <= win->_maxy; i++)
54                 if (win->_line[i].firstchar != _NOCHANGE)
55                         returnCode(TRUE);
56         returnCode(FALSE);
57 }
58
59 int wtouchln(WINDOW *win, int y, int n, int changed)
60 {
61 int i;
62
63         T((T_CALLED("wtouchln(%p,%d,%d,%d)"), win, y, n, changed));
64
65         for (i = y; i < y+n; i++) {
66                 win->_line[i].firstchar = changed ? 0 : _NOCHANGE;
67                 win->_line[i].lastchar = changed ? win->_maxx : _NOCHANGE;
68         }
69         returnCode(OK);
70 }