| 1 | #ifndef lint |
| 2 | static char *sccsid = "@(#)wwcursor.c 3.6 83/12/06"; |
| 3 | #endif |
| 4 | |
| 5 | #include "ww.h" |
| 6 | |
| 7 | wwcursor(w, on) |
| 8 | register struct ww *w; |
| 9 | { |
| 10 | register char *win; |
| 11 | |
| 12 | if (on) { |
| 13 | if (w->ww_hascursor) |
| 14 | return; |
| 15 | w->ww_hascursor = 1; |
| 16 | } else { |
| 17 | if (!w->ww_hascursor) |
| 18 | return; |
| 19 | w->ww_hascursor = 0; |
| 20 | } |
| 21 | if (wwcursormodes != 0) { |
| 22 | win = &w->ww_win[w->ww_cur.r][w->ww_cur.c]; |
| 23 | *win ^= wwcursormodes; |
| 24 | if (w->ww_cur.r < w->ww_i.t || w->ww_cur.r >= w->ww_i.b |
| 25 | || w->ww_cur.c < w->ww_i.l || w->ww_cur.c >= w->ww_i.r) |
| 26 | return; |
| 27 | if (wwsmap[w->ww_cur.r][w->ww_cur.c] == w->ww_index) { |
| 28 | if (*win == 0) |
| 29 | w->ww_nvis[w->ww_cur.r]++; |
| 30 | else if (*win == wwcursormodes) |
| 31 | w->ww_nvis[w->ww_cur.r]--; |
| 32 | wwns[w->ww_cur.r][w->ww_cur.c].c_m ^= wwcursormodes; |
| 33 | wwtouched[w->ww_cur.r] |= WWU_TOUCHED; |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | wwsetcursormodes(new) |
| 39 | register new; |
| 40 | { |
| 41 | register i; |
| 42 | register struct ww *w; |
| 43 | register old = wwcursormodes; |
| 44 | |
| 45 | new &= wwavailmodes; |
| 46 | if (new == wwcursormodes) |
| 47 | return; |
| 48 | for (i = 0; i < NWW; i++) |
| 49 | if (wwindex[i] != 0 && (w = wwindex[i])->ww_hascursor) { |
| 50 | wwcursor(w, 0); |
| 51 | wwcursormodes = new; |
| 52 | wwcursor(w, 1); |
| 53 | wwcursormodes = old; |
| 54 | } |
| 55 | wwcursormodes = new; |
| 56 | } |