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