xref: /original-bsd/sys/news3400/iop/mouse.h (revision 52960f3f)
1 /*
2  * Copyright (c) 1992, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Sony Corp. and Kazumasa Utashiro of Software Research Associates, Inc.
7  *
8  * %sccs.include.redist.c%
9  *
10  * from: $Hdr: mouse.h,v 4.300 91/06/09 06:42:56 root Rel41 $ SONY
11  *
12  *	@(#)mouse.h	8.1 (Berkeley) 06/11/93
13  */
14 
15 #ifndef __MOUSE__
16 #define __MOUSE__ 1
17 
18 /*
19  * mouse register structure definition.
20  */
21 
22 /*
23  * mouse data (mouse X, Y coordinates and its button status)
24  */
25 struct ms_data {
26     int	    md_sw;  /* mouse button */
27 #define	    MS_BUTNL	0x04
28 #define	    MS_BUTNM	0x02
29 #define	    MS_BUTNR	0x01
30     int	    md_x;   /* x coordinate */
31     int	    md_y;   /* y coordinate */
32 };
33 
34 struct ms_coord {
35     int	    mc_x;   /* x coordinate */
36     int	    mc_y;   /* y coordinate */
37 };
38 
39 struct ms_range {
40     struct ms_coord	mr_min;	/* upper left */
41     struct ms_coord	mr_max;	/* lower right */
42 };
43 
44 /*
45  * mouse event report
46  *	event report is queued when mouse is put in event mode
47  *	by using MIOC SETEM ioctl()
48  */
49 struct ms_event {
50     struct ms_data	mse_data;	/* mouse X, Y and button status */
51     char		mse_trig;	/* trigger that caused this event */
52 #define	MSE_MOTION	0		    /* mouse movement */
53 #define MSE_BUTTON	1		    /* mouse buttons */
54 #define MSE_KEY		2		    /* keyboard keys */
55     char		mse_dir;	/* key or button direction */
56 #define MSE_DOWN	0		    /* down */
57 #define MSE_UP		1		    /* up */
58 #define MSE_UNKOWN	2		    /* unkown */
59     char		mse_code;	/* key or button code */
60 #define MSE_BUTNR	0		    /* right button */
61 #define MSE_BUTNM	1		    /* middle button */
62 #define MSE_BUTNL	2		    /* left button */
63     char		mse_inval;
64   /* for key code, see below */
65     struct timeval	mse_time;	/* time when this event occurred */
66 };
67 
68 struct ms_queue {
69     int			mq_head;
70     int			mq_tail;
71 #define MS_MAXREPORT	170
72     struct ms_event	mq_queue[MS_MAXREPORT];
73     int			dummy[2];
74 };
75 
76 /* strct ms_param:
77  *	when mouse is moved more than mp_delta, amount that exceeds
78  *	the mp_delta is maginified by mp_mag(>0)
79  */
80 struct ms_param {
81     int    mp_delta;	/* threshold for maginification */
82     int	   mp_mag;	/* magifying factor */
83 };
84 
85 /* meaning of ms_eventmask */
86 #define	    MS_EMEVENT	0x80	/* 1 -> event mode */
87 #define	    MS_EMKEY	0x40	/* keyboard key changes -> event */
88 
89 		/* WARNING: use of MS_EMCORD[XY] is no recomended
90 		 *	MS_EMCORD[XY] will disappear shortly
91 		 */
92 #define	    MS_EMCORDY	0x20	/* coordinate y changes -> event */
93 #define	    MS_EMCORDX	0x10	/* coordinate x changes -> event */
94 
95 #define	    MS_EMMOTION	0x10	/* coordinates changes -> event */
96 #define	    MS_EMBUTNL	0x04	/* left button changes -> event */
97 #define	    MS_EMBUTNM	0x02	/* mid button changes -> event */
98 #define	    MS_EMBUTNR	0x01	/* right button changes -> event */
99 
100 
101 /*
102  * Key Code
103  */
104 
105 #define KEY_A		41
106 #define KEY_B		59
107 #define KEY_C		57
108 #define KEY_D		43
109 #define KEY_E		29
110 #define KEY_F		44
111 #define KEY_G		45
112 #define KEY_H		46
113 #define KEY_I		34
114 #define KEY_J		47
115 #define KEY_K		48
116 #define KEY_L		49
117 #define KEY_M		61
118 #define KEY_N		60
119 #define KEY_O		35
120 #define KEY_P		36
121 #define KEY_Q		27
122 #define KEY_R		30
123 #define KEY_S		42
124 #define KEY_T		31
125 #define KEY_U		33
126 #define KEY_V		58
127 #define KEY_W		28
128 #define KEY_X		56
129 #define KEY_Y		32
130 #define KEY_Z		55
131 #define KEY_0		21
132 #define KEY_1		12
133 #define KEY_2		13
134 #define KEY_3		14
135 #define KEY_4		15
136 #define KEY_5		16
137 #define KEY_6		17
138 #define KEY_7		18
139 #define KEY_8		19
140 #define KEY_9		20
141 #define KEY_MINUS	22	/* - */
142 #define KEY_EQUAL	23	/* = */
143 #define KEY_YEN		24	/* \ */
144 #define KEY_BRA		37	/* [ */
145 #define KEY_KET		38	/* ] */
146 #define KEY_SEMICOL	50	/* ; */
147 #define KEY_SQUOTE	51	/* ' */
148 #define KEY_BQUOTE	52	/* ` */
149 #define KEY_COMMA	62	/* , */
150 #define KEY_PERIOD	63	/* . */
151 #define KEY_SLASH	64	/* / */
152 #define KEY_RO		65	/* 'RO' (katakana) */
153 #define KEY_ESC		11
154 #define KEY_TAB		26
155 #define KEY_BS		25
156 #define KEY_DEL		39
157 #define KEY_CR		53	/* carrige return */
158 #define KEY_SP		70	/* space */
159 #define KEY_CTRL	40
160 #define KEY_SHIFTL	54	/* left shift key */
161 #define KEY_SHIFTR	66	/* right shift key */
162 #define KEY_ALT		67
163 #define KEY_CAPS	68
164 #define KEY_MUHENKAN	69
165 #define KEY_HENKAN	71
166 #define KEY_EISUU	72
167 #define KEY_KANA	73
168 #define KEY_JIKKOU	74
169 
170 /* function key */
171 #define KEY_F1		1
172 #define KEY_F2		2
173 #define KEY_F3		3
174 #define KEY_F4		4
175 #define KEY_F5		5
176 #define KEY_F6		6
177 #define KEY_F7		7
178 #define KEY_F8		8
179 #define KEY_F9		9
180 #define KEY_F10		10
181 
182 /* numeric keypad */
183 #define NKEY_0		87
184 #define NKEY_1		83
185 #define NKEY_2		84
186 #define NKEY_3		85
187 #define NKEY_4		79
188 #define NKEY_5		80
189 #define NKEY_6		81
190 #define NKEY_7		75
191 #define NKEY_8		76
192 #define NKEY_9		77
193 #define NKEY_PERIOD	89
194 #define NKEY_MINUS	78
195 #define NKEY_PLUS	82
196 #define NKEY_COMMA	86
197 #define NKEY_CR		90
198 #define NKEY_LEFT	91	/* arrow key */
199 #define NKEY_RIGHT	93
200 #define NKEY_UP		88
201 #define NKEY_DOWN	92
202 #define OKEY_SPACE	94
203 #define OKEY_EISUU	95
204 #define OKEY_SHIFTL	96
205 #define OKEY_SHIFTR	97
206 #define OKEY_KANA	98
207 #define OKEY_EQUAL	99
208 #define OKEY_ASTERISK	100
209 #define OKEY_SLASH	101
210 #define OKEY_TAB	102
211 
212 /*
213  * Mouse I/O contol commands
214  */
215 
216 #include <sys/ioctl.h>
217 
218 #define	MSIOCGETEM	_IOR('M', 0, int)	/* get current event mask */
219 #define	MSIOCSETEM	_IOW('M', 1, int)	/* set event mask */
220 #define	MSIOCSETXY	_IOW('M', 2, struct ms_coord) /* set current x, y */
221 #define	MSIOCFLUSH	_IO('M', 3)		/* flush event queue */
222 #define	MSIOCSETPARAM	_IOW('M', 4, struct ms_param) /* set mouse parameter */
223 #define	MSIOCSETRANGE	_IOW('M', 5, struct ms_range) /* set mouse coordinate range */
224 
225 #endif /* !__MOUSE__ */
226