xref: /titanic_41/usr/src/uts/common/sys/msreg.h (revision 581cede61ac9c14d8d4ea452562a567189eead78)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SunOS4.0 4.24 */
35 
36 
37 #include <sys/types.h>
38 #include <sys/types32.h>
39 
40 #ifdef	__cplusplus
41 extern "C" {
42 #endif
43 
44 /*
45  * Mouse sample.
46  */
47 struct	mouseinfo {
48 	char	mi_x;		/* current X coordinate */
49 	char	mi_y;		/* current Y coordinate */
50 	char	mi_z;		/* current wheel */
51 	char	mi_buttons;	/* set of buttons that are currently down */
52 #define	MS_HW_BUT1	0x4	/* left button position */
53 #define	MS_HW_BUT2	0x2	/* middle button position */
54 #define	MS_HW_BUT3	0x1	/* right button position */
55 	struct	timeval32 mi_time; /* timestamp */
56 };
57 
58 /*
59  * Circular buffer storing mouse events.
60  */
61 struct	mousebuf {
62 	short	mb_size;	/* size (in mouseinfo units) of buf */
63 	short	mb_off;		/* current offset in buffer */
64 	struct	mouseinfo mb_info[1];	/* however many samples */
65 };
66 
67 struct	ms_softc {
68 	struct	mousebuf *ms_buf;	/* pointer to mouse buffer */
69 	short	ms_bufbytes;		/* buffer size (in bytes) */
70 	short	ms_flags;		/* currently unused */
71 	short	ms_oldoff;		/* index into mousebuf */
72 	short	ms_eventstate;		/* current event being generated */
73 	short	ms_readformat;		/* format of read stream */
74 #define	MS_3BYTE_FORMAT	VUID_NATIVE	/* 3 byte format (buts/x/y) */
75 #define	MS_VUID_FORMAT	VUID_FIRM_EVENT	/* vuid Firm_event format */
76 	short	ms_vuidaddr;		/* vuid addr for MS_VUID_FORMAT */
77 	char	ms_prevbuttons;		/* button state as of last message */
78 					/* sent upstream */
79 };
80 
81 #define	EVENT_X		0	/* generating delta-X event */
82 #define	EVENT_Y		1	/* generating delta-Y event */
83 #define	EVENT_BUT1	2	/* generating button 1 event */
84 #define	EVENT_BUT2	3	/* generating button 2 event */
85 #define	EVENT_BUT3	4	/* generating button 3 event */
86 #define	EVENT_BUT4	5	/* generating button 4 event */
87 #define	EVENT_BUT5	6	/* generating button 5 event */
88 #define	EVENT_BUT6	7	/* generating button 6 event */
89 #define	EVENT_BUT7	8	/* generating button 7 event */
90 #define	EVENT_BUT8	9	/* generating button 8 event */
91 #define	EVENT_BUT9	10	/* generating button 9 event */
92 #define	EVENT_BUT10	11	/* generating button 10 event */
93 #define	EVENT_WHEEL	12	/* generating wheel    event */
94 
95 #define	EVENT_BUT(i)	(i + 1)
96 
97 #ifdef _KERNEL
98 #define	MSIOGETBUF	_IOWR('m', 1, int)	/* MSIOGETBUF is OBSOLETE */
99 	/* Get mouse buffer ptr so (window system in particular) can chase */
100 	/* around buffer to get events. */
101 #endif
102 
103 #ifdef	__cplusplus
104 }
105 #endif
106 
107 #endif	/* _SYS_MSREG_H */
108