xref: /illumos-gate/usr/src/uts/common/sys/msreg.h (revision 16b76d3cb933ff92018a2a75594449010192eacb)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * Software mouse registers
29  */
30 
31 #ifndef _SYS_MSREG_H
32 #define	_SYS_MSREG_H
33 
34 #include <sys/types.h>
35 #include <sys/types32.h>
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 /*
42  * Mouse sample.
43  */
44 struct	mouseinfo {
45 	char	mi_x;		/* current X coordinate */
46 	char	mi_y;		/* current Y coordinate */
47 	char	mi_z;		/* current wheel */
48 	char	mi_buttons;	/* set of buttons that are currently down */
49 #define	MS_HW_BUT1	0x4	/* left button position */
50 #define	MS_HW_BUT2	0x2	/* middle button position */
51 #define	MS_HW_BUT3	0x1	/* right button position */
52 	struct	timeval32 mi_time; /* timestamp */
53 };
54 
55 /*
56  * Circular buffer storing mouse events.
57  */
58 struct	mousebuf {
59 	short	mb_size;	/* size (in mouseinfo units) of buf */
60 	short	mb_off;		/* current offset in buffer */
61 	struct	mouseinfo mb_info[1];	/* however many samples */
62 };
63 
64 struct	ms_softc {
65 	struct	mousebuf *ms_buf;	/* pointer to mouse buffer */
66 	short	ms_bufbytes;		/* buffer size (in bytes) */
67 	short	ms_flags;		/* currently unused */
68 	short	ms_oldoff;		/* index into mousebuf */
69 	short	ms_eventstate;		/* current event being generated */
70 	short	ms_readformat;		/* format of read stream */
71 #define	MS_3BYTE_FORMAT	VUID_NATIVE	/* 3 byte format (buts/x/y) */
72 #define	MS_VUID_FORMAT	VUID_FIRM_EVENT	/* vuid Firm_event format */
73 	short	ms_vuidaddr;		/* vuid addr for MS_VUID_FORMAT */
74 	char	ms_prevbuttons;		/* button state as of last message */
75 					/* sent upstream */
76 };
77 
78 #define	EVENT_X		0	/* generating delta-X event */
79 #define	EVENT_Y		1	/* generating delta-Y event */
80 #define	EVENT_BUT1	2	/* generating button 1 event */
81 #define	EVENT_BUT2	3	/* generating button 2 event */
82 #define	EVENT_BUT3	4	/* generating button 3 event */
83 #define	EVENT_BUT4	5	/* generating button 4 event */
84 #define	EVENT_BUT5	6	/* generating button 5 event */
85 #define	EVENT_BUT6	7	/* generating button 6 event */
86 #define	EVENT_BUT7	8	/* generating button 7 event */
87 #define	EVENT_BUT8	9	/* generating button 8 event */
88 #define	EVENT_BUT9	10	/* generating button 9 event */
89 #define	EVENT_BUT10	11	/* generating button 10 event */
90 #define	EVENT_WHEEL	12	/* generating wheel    event */
91 
92 #define	EVENT_BUT(i)	(i + 1)
93 
94 #ifdef _KERNEL
95 #define	MSIOGETBUF	_IOWR('m', 1, int)	/* MSIOGETBUF is OBSOLETE */
96 	/* Get mouse buffer ptr so (window system in particular) can chase */
97 	/* around buffer to get events. */
98 #endif
99 
100 #ifdef	__cplusplus
101 }
102 #endif
103 
104 #endif	/* _SYS_MSREG_H */
105