xref: /illumos-gate/usr/src/uts/i86pc/sys/xque.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 (c) 1997-1998 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1990, 1991 UNIX System Laboratories, Inc.	*/
28*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T	*/
29*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate #ifndef _SYS_XQUE_H
32*7c478bd9Sstevel@tonic-gate #define	_SYS_XQUE_H
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
35*7c478bd9Sstevel@tonic-gate extern "C" {
36*7c478bd9Sstevel@tonic-gate #endif
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate /*
39*7c478bd9Sstevel@tonic-gate  * Keyboard/mouse event queue entries
40*7c478bd9Sstevel@tonic-gate  */
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate typedef struct xqEvent {
43*7c478bd9Sstevel@tonic-gate 	uchar_t	xq_type;	/* event type (see below) */
44*7c478bd9Sstevel@tonic-gate 	uchar_t	xq_code;	/* when xq_type is XQ_KEY, => scan code; */
45*7c478bd9Sstevel@tonic-gate 				/* when xq_type is XQ_MOTION or XQ_BUTTON, => */
46*7c478bd9Sstevel@tonic-gate 				/*	bit 0 clear if right button pushed; */
47*7c478bd9Sstevel@tonic-gate 				/*	bit 1 clear if middle button pushed; */
48*7c478bd9Sstevel@tonic-gate 				/*	bit 2 clear if left button pushed; */
49*7c478bd9Sstevel@tonic-gate 	char	xq_x;		/* delta x movement (mouse motion only) */
50*7c478bd9Sstevel@tonic-gate 	char	xq_y;		/* delta y movement (mouse motion only) */
51*7c478bd9Sstevel@tonic-gate 	time_t	xq_time; 	/* event timestamp in "milliseconds" */
52*7c478bd9Sstevel@tonic-gate } xqEvent;
53*7c478bd9Sstevel@tonic-gate 
54*7c478bd9Sstevel@tonic-gate /*	xq_type values		*/
55*7c478bd9Sstevel@tonic-gate 
56*7c478bd9Sstevel@tonic-gate #define	XQ_BUTTON	0	/* button state change only */
57*7c478bd9Sstevel@tonic-gate #define	XQ_MOTION	1	/* mouse movement (and maybe button change) */
58*7c478bd9Sstevel@tonic-gate #define	XQ_KEY		2	/* key pressed or released */
59*7c478bd9Sstevel@tonic-gate 
60*7c478bd9Sstevel@tonic-gate /*
61*7c478bd9Sstevel@tonic-gate  * The event queue
62*7c478bd9Sstevel@tonic-gate  */
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate typedef struct xqEventQueue {
65*7c478bd9Sstevel@tonic-gate 	char	xq_sigenable;	/* allow signal when queue becomes non-empty */
66*7c478bd9Sstevel@tonic-gate 				/* 0 => don't send signals */
67*7c478bd9Sstevel@tonic-gate 				/* non-zero => send a signal if queue is */
68*7c478bd9Sstevel@tonic-gate 				/*	empty and a new event is added */
69*7c478bd9Sstevel@tonic-gate 	int	xq_head;	/* index into queue of next event to be */
70*7c478bd9Sstevel@tonic-gate 				/* dequeued */
71*7c478bd9Sstevel@tonic-gate 	int	xq_tail;	/* index into queue of next event slot to */
72*7c478bd9Sstevel@tonic-gate 				/* be filled */
73*7c478bd9Sstevel@tonic-gate 	time_t	xq_curtime;	/* time in milliseconds since 1/1/70 GMT */
74*7c478bd9Sstevel@tonic-gate 	int	xq_size;	/* number of elements in xq_events array */
75*7c478bd9Sstevel@tonic-gate 	xqEvent	xq_events[1];	/* configurable-size array of events */
76*7c478bd9Sstevel@tonic-gate } xqEventQueue;
77*7c478bd9Sstevel@tonic-gate 
78*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate /*
81*7c478bd9Sstevel@tonic-gate  * The driver's private data structure to keep track of xqEventQueue
82*7c478bd9Sstevel@tonic-gate  */
83*7c478bd9Sstevel@tonic-gate 
84*7c478bd9Sstevel@tonic-gate typedef struct xqInfo {
85*7c478bd9Sstevel@tonic-gate 	xqEventQueue	*xq_queue;	/* pointer to the xqEventQueue */
86*7c478bd9Sstevel@tonic-gate 					/* structure */
87*7c478bd9Sstevel@tonic-gate 	caddr_t xq_private;
88*7c478bd9Sstevel@tonic-gate 	caddr_t	xq_qaddr;	/* pointer to the SCO QUEUE structure */
89*7c478bd9Sstevel@tonic-gate 	char	xq_qtype;	/* xque or SCO que */
90*7c478bd9Sstevel@tonic-gate 	char	xq_buttons;
91*7c478bd9Sstevel@tonic-gate 	char	xq_devices;	/* devices that uses the SCO que */
92*7c478bd9Sstevel@tonic-gate 	char	xq_xlate;	/* Should we translate scancodes? */
93*7c478bd9Sstevel@tonic-gate 	int	(*xq_addevent)();	/* xque or SCO que addevent routine */
94*7c478bd9Sstevel@tonic-gate 	int	xq_ptail;	/* private copy of xq_tail */
95*7c478bd9Sstevel@tonic-gate 	int	xq_psize;	/* private copy of xq_size */
96*7c478bd9Sstevel@tonic-gate 	int	xq_signo;	/* signal number to send for xq_sigenable */
97*7c478bd9Sstevel@tonic-gate 	proc_t	*xq_proc;	/* pointer to x server process */
98*7c478bd9Sstevel@tonic-gate 				/* (for signalling) */
99*7c478bd9Sstevel@tonic-gate 	int	xq_pid;		/* process id of server process */
100*7c478bd9Sstevel@tonic-gate 	struct xqInfo	*xq_next,	/* next xqInfo structure in list */
101*7c478bd9Sstevel@tonic-gate 			*xq_prev;	/* previous xqInfo structure in list */
102*7c478bd9Sstevel@tonic-gate 	addr_t	xq_uaddr;
103*7c478bd9Sstevel@tonic-gate 	unsigned	xq_npages;
104*7c478bd9Sstevel@tonic-gate } xqInfo;
105*7c478bd9Sstevel@tonic-gate 
106*7c478bd9Sstevel@tonic-gate /*  defined bits for xq_devices */
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate #define	QUE_KEYBOARD	1
109*7c478bd9Sstevel@tonic-gate #define	QUE_MOUSE	2
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
112*7c478bd9Sstevel@tonic-gate 
113*7c478bd9Sstevel@tonic-gate caddr_t xq_init();
114*7c478bd9Sstevel@tonic-gate 
115*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
116*7c478bd9Sstevel@tonic-gate }
117*7c478bd9Sstevel@tonic-gate #endif
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_XQUE_H */
120