wsmoused.h revision 1.3 1 1.3 jmmv /* $NetBSD: wsmoused.h,v 1.3 2003/03/04 14:33:55 jmmv Exp $ */
2 1.1 christos
3 1.1 christos /*
4 1.1 christos * Copyright (c) 2002 The NetBSD Foundation, Inc.
5 1.1 christos * All rights reserved.
6 1.1 christos *
7 1.1 christos * This code is derived from software contributed to The NetBSD Foundation
8 1.1 christos * by Julio Merino.
9 1.1 christos *
10 1.1 christos * Redistribution and use in source and binary forms, with or without
11 1.1 christos * modification, are permitted provided that the following conditions
12 1.1 christos * are met:
13 1.1 christos * 1. Redistributions of source code must retain the above copyright
14 1.1 christos * notice, this list of conditions and the following disclaimer.
15 1.1 christos * 2. The name authors may not be used to endorse or promote products
16 1.1 christos * derived from this software without specific prior written
17 1.1 christos * permission.
18 1.1 christos *
19 1.1 christos * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
20 1.1 christos * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 1.1 christos * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 1.1 christos * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
23 1.1 christos * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 1.1 christos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25 1.1 christos * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.1 christos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 1.1 christos * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 1.1 christos * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 1.1 christos * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 1.1 christos */
31 1.1 christos
32 1.1 christos #ifndef _WSMOUSED_WSMOUSED_H
33 1.1 christos #define _WSMOUSED_WSMOUSED_H
34 1.1 christos
35 1.1 christos struct mouse {
36 1.1 christos /* File descriptors and names */
37 1.1 christos int fd;
38 1.1 christos int tty_fd;
39 1.1 christos int stat_fd;
40 1.1 christos int fifo_fd;
41 1.1 christos char *device_name;
42 1.1 christos char *fifo_name;
43 1.3 jmmv char *tstat_name;
44 1.1 christos
45 1.1 christos /* Screen coordinates */
46 1.1 christos size_t row, col;
47 1.1 christos size_t max_row, max_col;
48 1.1 christos
49 1.1 christos /* Movement information */
50 1.1 christos size_t slowdown_x, slowdown_y;
51 1.1 christos size_t count_row, count_col;
52 1.1 christos
53 1.1 christos int cursor;
54 1.1 christos int selecting;
55 1.1 christos int disabled;
56 1.2 jmmv
57 1.2 jmmv /* Button configuration */
58 1.2 jmmv int but_select;
59 1.2 jmmv int but_paste;
60 1.1 christos };
61 1.1 christos
62 1.3 jmmv struct prop {
63 1.3 jmmv char *p_name;
64 1.3 jmmv char *p_value;
65 1.3 jmmv };
66 1.3 jmmv
67 1.3 jmmv #define MAX_EVENTS 10
68 1.3 jmmv #define MAX_BLOCKS 10
69 1.3 jmmv #define MAX_PROPS 100
70 1.3 jmmv #define BLOCK_GLOBAL 1
71 1.3 jmmv #define BLOCK_MODE 2
72 1.3 jmmv #define BLOCK_EVENT 3
73 1.3 jmmv struct block {
74 1.3 jmmv char *b_name;
75 1.3 jmmv int b_type;
76 1.3 jmmv int b_prop_count;
77 1.3 jmmv int b_child_count;
78 1.3 jmmv struct prop *b_prop[MAX_BLOCKS];
79 1.3 jmmv struct block *b_child[MAX_BLOCKS];
80 1.3 jmmv struct block *b_parent;
81 1.3 jmmv };
82 1.3 jmmv
83 1.1 christos /* Prototypes for wsmoused.c */
84 1.1 christos void char_invert(struct mouse *, size_t, size_t);
85 1.1 christos void mouse_cursor_show(struct mouse *);
86 1.1 christos void mouse_cursor_hide(struct mouse *);
87 1.1 christos void mouse_open_tty(struct mouse *, int);
88 1.3 jmmv
89 1.3 jmmv /* Prototypes for config.c */
90 1.3 jmmv struct prop *prop_new(void);
91 1.3 jmmv void prop_free(struct prop *);
92 1.3 jmmv struct block *block_new(int);
93 1.3 jmmv void block_free(struct block *);
94 1.3 jmmv void block_add_prop(struct block *, struct prop *);
95 1.3 jmmv void block_add_child(struct block *, struct block *);
96 1.3 jmmv char *block_get_propval(struct block *, char *, char *);
97 1.3 jmmv int block_get_propval_int(struct block *, char *, int);
98 1.3 jmmv struct block *config_get_mode(char *);
99 1.3 jmmv void config_read(char *, int);
100 1.3 jmmv void config_free(void);
101 1.1 christos
102 1.1 christos /* Prototypes for event.c */
103 1.1 christos void mouse_motion_event(struct mouse *, struct wscons_event *);
104 1.1 christos void mouse_button_event(struct mouse *, struct wscons_event *);
105 1.1 christos void screen_event(struct mouse *, struct wscons_event *);
106 1.1 christos
107 1.1 christos /* Prototypes for selection.c */
108 1.1 christos void mouse_sel_init(void);
109 1.1 christos void mouse_sel_start(struct mouse *);
110 1.1 christos void mouse_sel_end(struct mouse *);
111 1.1 christos void mouse_sel_calculate(struct mouse *);
112 1.1 christos void mouse_sel_hide(struct mouse *);
113 1.1 christos void mouse_sel_show(struct mouse *);
114 1.1 christos void mouse_sel_paste(struct mouse *);
115 1.1 christos
116 1.1 christos #endif /* _WSMOUSED_WSMOUSED_H */
117