Commit | Line | Data |
---|---|---|
60de5df9 | 1 | /* |
46e9ea25 KB |
2 | * Copyright (c) 1983 Regents of the University of California. |
3 | * All rights reserved. | |
4 | * | |
3dd3a9e5 KB |
5 | * This code is derived from software contributed to Berkeley by |
6 | * Edward Wang at The University of California, Berkeley. | |
7 | * | |
87f529ec | 8 | * %sccs.include.redist.c% |
60de5df9 EW |
9 | */ |
10 | ||
46e9ea25 | 11 | #ifndef lint |
3dd3a9e5 | 12 | static char sccsid[] = "@(#)wwcursor.c 3.12 (Berkeley) %G%"; |
46e9ea25 KB |
13 | #endif /* not lint */ |
14 | ||
120c3815 EW |
15 | #include "ww.h" |
16 | ||
17 | wwcursor(w, on) | |
18 | register struct ww *w; | |
19 | { | |
20 | register char *win; | |
120c3815 EW |
21 | |
22 | if (on) { | |
23 | if (w->ww_hascursor) | |
24 | return; | |
25 | w->ww_hascursor = 1; | |
26 | } else { | |
27 | if (!w->ww_hascursor) | |
28 | return; | |
29 | w->ww_hascursor = 0; | |
30 | } | |
31 | if (wwcursormodes != 0) { | |
32 | win = &w->ww_win[w->ww_cur.r][w->ww_cur.c]; | |
120c3815 | 33 | *win ^= wwcursormodes; |
f2a77fe1 EW |
34 | if (w->ww_cur.r < w->ww_i.t || w->ww_cur.r >= w->ww_i.b |
35 | || w->ww_cur.c < w->ww_i.l || w->ww_cur.c >= w->ww_i.r) | |
19f9784c | 36 | return; |
f2a77fe1 | 37 | if (wwsmap[w->ww_cur.r][w->ww_cur.c] == w->ww_index) { |
84ad208b EW |
38 | if (*win == 0) |
39 | w->ww_nvis[w->ww_cur.r]++; | |
40 | else if (*win == wwcursormodes) | |
41 | w->ww_nvis[w->ww_cur.r]--; | |
f2a77fe1 | 42 | wwns[w->ww_cur.r][w->ww_cur.c].c_m ^= wwcursormodes; |
04d70db4 | 43 | wwtouched[w->ww_cur.r] |= WWU_TOUCHED; |
19f9784c | 44 | } |
120c3815 EW |
45 | } |
46 | } | |
35ffbdff EW |
47 | |
48 | wwsetcursormodes(new) | |
49 | register new; | |
50 | { | |
51 | register i; | |
52 | register struct ww *w; | |
53 | register old = wwcursormodes; | |
54 | ||
55 | new &= wwavailmodes; | |
56 | if (new == wwcursormodes) | |
57 | return; | |
58 | for (i = 0; i < NWW; i++) | |
59 | if (wwindex[i] != 0 && (w = wwindex[i])->ww_hascursor) { | |
60 | wwcursor(w, 0); | |
61 | wwcursormodes = new; | |
62 | wwcursor(w, 1); | |
63 | wwcursormodes = old; | |
64 | } | |
65 | wwcursormodes = new; | |
66 | } |