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