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