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