1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 struct wsdisplay_softc;
41
42 int wsmoused(struct wsdisplay_softc *, u_long, caddr_t, int,
43 struct proc *p);
44
45 void motion_event(u_int, int);
46 void button_event(int, int);
47 int ctrl_event(u_int, int, struct wsdisplay_softc *, struct proc *);
48
49 void mouse_moverel(char, char);
50
51 void inverse_char(unsigned short c);
52 void inverse_region(unsigned short start, unsigned short end);
53
54 unsigned char skip_spc_right(char);
55 unsigned char skip_spc_left(void);
56 unsigned char skip_char_right(unsigned short);
57 unsigned char skip_char_left(unsigned short);
58 unsigned char class_cmp(unsigned short, unsigned short);
59
60 void mouse_copy_start(void);
61 void mouse_copy_word(void);
62 void mouse_copy_line(void);
63 void mouse_copy_end(void);
64 void mouse_copy_extend(void);
65 void mouse_copy_extend_char(void);
66 void mouse_copy_extend_word(void);
67 void mouse_copy_extend_line(void);
68 void mouse_hide(struct wsdisplay_softc *);
69 void mouse_copy_extend_after(void);
70 void remove_selection(struct wsdisplay_softc *);
71 void mouse_copy_selection(void);
72 void mouse_paste(void);
73
74 void mouse_zaxis(int);
75 void allocate_copybuffer(struct wsdisplay_softc *);
76 void mouse_remove(struct wsdisplay_softc *);
77 void wsmoused_release(struct wsdisplay_softc *);
78 void wsmoused_wakeup(struct wsdisplay_softc *);
79
80 extern char *Copybuffer;
81 extern u_int Copybuffer_size;
82 extern char Paste_avail;
83
84
85 #define NO_BORDER 0
86 #define BORDER 1
87
88 #define WS_NCOLS(ws) ((ws)->scr_dconf->scrdata->ncols)
89 #define WS_NROWS(ws) ((ws)->scr_dconf->scrdata->nrows)
90
91 #define MAXCOL (WS_NCOLS(sc->sc_focus) - 1)
92 #define MAXROW (WS_NROWS(sc->sc_focus) - 1)
93
94 #define N_COLS (WS_NCOLS(sc->sc_focus))
95 #define N_ROWS (WS_NROWS(sc->sc_focus))
96 #define MOUSE (sc->sc_focus->mouse)
97 #define CURSOR (sc->sc_focus->cursor)
98 #define CPY_START (sc->sc_focus->cpy_start)
99 #define CPY_END (sc->sc_focus->cpy_end)
100 #define ORIG_START (sc->sc_focus->orig_start)
101 #define ORIG_END (sc->sc_focus->orig_end)
102 #define MOUSE_FLAGS (sc->sc_focus->mouse_flags)
103
104 #define XY_TO_POS(col, row) (((row) * N_COLS) + (col))
105 #define POS_TO_X(pos) ((pos) % (N_COLS))
106 #define POS_TO_Y(pos) ((pos) / (N_COLS))
107
108
109 #define GETCHAR(pos, cellp) \
110 ((*sc->sc_accessops->getchar) \
111 (sc->sc_accesscookie, (pos) / N_COLS, (pos) % N_COLS, cellp))
112 #define PUTCHAR(pos, uc, attr) \
113 ((*sc->sc_focus->scr_dconf->emulops->putchar) \
114 (sc->sc_focus->scr_dconf->emulcookie, ((pos) / N_COLS), \
115 ((pos) % N_COLS), (uc), (attr)))
116
117 #define MOUSE_COPY_BUTTON 0
118 #define MOUSE_PASTE_BUTTON 1
119 #define MOUSE_EXTEND_BUTTON 2
120
121 #define IS_ALPHANUM(c) ((c) != ' ')
122 #define IS_SPACE(c) ((c) == ' ')