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