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