1 /************************************************************
3 Copyright (c) 1987 X Consortium
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 Except as contained in this notice, the name of the X Consortium shall not be
23 used in advertising or otherwise to promote the sale, use or other dealings
24 in this Software without prior written authorization from the X Consortium.
27 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
31 Permission to use, copy, modify, and distribute this software and its
32 documentation for any purpose and without fee is hereby granted,
33 provided that the above copyright notice appear in all copies and that
34 both that copyright notice and this permission notice appear in
35 supporting documentation, and that the name of Digital not be
36 used in advertising or publicity pertaining to distribution of the
37 software without specific, written prior permission.
39 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
40 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
41 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
42 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
43 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
44 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
47 ********************************************************/
49 /* $XConsortium: inputstr.h /main/28 1996/09/25 00:51:24 dpw $ */
56 #include "dixstruct.h"
58 #define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
60 #define SameClient(obj,client) \
61 (CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
65 #define EMASKSIZE MAX_DEVICES
67 /* Kludge: OtherClients and InputClients must be compatible, see code */
69 typedef struct _OtherClients {
71 XID resource; /* id for putting into resource manager */
75 typedef struct _InputClients {
77 XID resource; /* id for putting into resource manager */
81 typedef struct _OtherInputMasks {
82 Mask deliverableEvents[EMASKSIZE];
83 Mask inputEvents[EMASKSIZE];
84 Mask dontPropagateMask[EMASKSIZE];
85 InputClientsPtr inputClients;
89 * The following structure gets used for both active and passive grabs. For
90 * active grabs some of the fields (e.g. modifiers) are not used. However,
91 * that is not much waste since there aren't many active grabs (one per
92 * keyboard/pointer device) going at once in the server.
95 #define MasksPerDetailMask 8 /* 256 keycodes and 256 possible
96 modifier combinations, but only
99 typedef struct _DetailRec { /* Grab details may be bit masks */
100 unsigned short exact;
104 typedef struct _GrabRec {
105 GrabPtr next; /* for chain of passive grabs */
109 unsigned ownerEvents:1;
110 unsigned keyboardMode:1;
111 unsigned pointerMode:1;
112 unsigned coreGrab:1; /* grab is on core device */
113 unsigned coreMods:1; /* modifiers are on core keyboard */
114 CARD8 type; /* event type */
115 DetailRec modifiersDetail;
116 DeviceIntPtr modifierDevice;
117 DetailRec detail; /* key or button */
118 WindowPtr confineTo; /* always NULL for keyboards */
119 CursorPtr cursor; /* always NULL for keyboards */
123 typedef struct _KeyClassRec {
124 CARD8 down[DOWN_LENGTH];
125 KeyCode *modifierKeyMap;
126 KeySymsRec curKeySyms;
127 int modifierKeyCount[8];
128 CARD8 modifierMap[MAP_LENGTH];
129 CARD8 maxKeysPerModifier;
130 unsigned short state;
131 unsigned short prev_state;
133 struct _XkbSrvInfo *xkbInfo;
135 } KeyClassRec, *KeyClassPtr;
137 typedef struct _AxisInfo {
143 } AxisInfo, *AxisInfoPtr;
145 typedef struct _ValuatorClassRec {
146 ValuatorMotionProcPtr GetMotionProc;
148 WindowPtr motionHintWindow;
150 unsigned short numAxes;
153 } ValuatorClassRec, *ValuatorClassPtr;
155 typedef struct _ButtonClassRec {
157 CARD8 buttonsDown; /* number of buttons currently down */
158 unsigned short state;
160 CARD8 down[DOWN_LENGTH];
161 CARD8 map[MAP_LENGTH];
163 union _XkbAction * xkb_acts;
165 } ButtonClassRec, *ButtonClassPtr;
167 typedef struct _FocusClassRec {
174 } FocusClassRec, *FocusClassPtr;
176 typedef struct _ProximityClassRec {
178 } ProximityClassRec, *ProximityClassPtr;
180 typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr;
181 typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr;
182 typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr;
183 typedef struct _StringFeedbackClassRec *StringFeedbackPtr;
184 typedef struct _BellFeedbackClassRec *BellFeedbackPtr;
185 typedef struct _LedFeedbackClassRec *LedFeedbackPtr;
187 typedef struct _KbdFeedbackClassRec {
188 BellProcPtr BellProc;
189 KbdCtrlProcPtr CtrlProc;
193 struct _XkbSrvLedInfo *xkb_sli;
195 } KbdFeedbackClassRec;
197 typedef struct _PtrFeedbackClassRec {
198 PtrCtrlProcPtr CtrlProc;
201 } PtrFeedbackClassRec;
203 typedef struct _IntegerFeedbackClassRec {
204 IntegerCtrlProcPtr CtrlProc;
206 IntegerFeedbackPtr next;
207 } IntegerFeedbackClassRec;
209 typedef struct _StringFeedbackClassRec {
210 StringCtrlProcPtr CtrlProc;
212 StringFeedbackPtr next;
213 } StringFeedbackClassRec;
215 typedef struct _BellFeedbackClassRec {
216 BellProcPtr BellProc;
217 BellCtrlProcPtr CtrlProc;
219 BellFeedbackPtr next;
220 } BellFeedbackClassRec;
222 typedef struct _LedFeedbackClassRec {
223 LedCtrlProcPtr CtrlProc;
227 struct _XkbSrvLedInfo *xkb_sli;
229 } LedFeedbackClassRec;
231 /* states for devices */
233 #define NOT_GRABBED 0
235 #define THAWED_BOTH 2 /* not a real state */
236 #define FREEZE_NEXT_EVENT 3
237 #define FREEZE_BOTH_NEXT_EVENT 4
238 #define FROZEN 5 /* any state >= has device frozen */
239 #define FROZEN_NO_EVENT 5
240 #define FROZEN_WITH_EVENT 6
241 #define THAW_OTHERS 7
243 typedef struct _DeviceIntRec {
247 Bool startup; /* true if needs to be turned on at
248 server intialization time */
249 DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is
250 used to initialize, turn on, or
251 turn off the device */
252 Bool inited; /* TRUE if INIT returns Success */
253 GrabPtr grab; /* the grabber - used by DIX */
257 GrabPtr other; /* if other grab has this frozen */
258 xEvent *event; /* saved to be replayed */
265 Bool fromPassiveGrab;
267 void (*ActivateGrab) (
268 #if NeedNestedPrototypes
269 DeviceIntPtr /*device*/,
275 void (*DeactivateGrab)(
276 #if NeedNestedPrototypes
277 DeviceIntPtr /*device*/
281 ValuatorClassPtr valuator;
282 ButtonClassPtr button;
284 ProximityClassPtr proximity;
285 KbdFeedbackPtr kbdfeed;
286 PtrFeedbackPtr ptrfeed;
287 IntegerFeedbackPtr intfeed;
288 StringFeedbackPtr stringfeed;
289 BellFeedbackPtr bell;
292 struct _XkbInterest * xkb_interest;
297 int numDevices; /* total number of devices */
298 DeviceIntPtr devices; /* all devices turned on */
299 DeviceIntPtr off_devices; /* all devices turned off */
300 DeviceIntPtr keyboard; /* the main one for the server */
301 DeviceIntPtr pointer;
304 extern InputInfo inputInfo;
306 /* for keeping the events for devices grabbed synchronously */
307 typedef struct _QdEvent *QdEventPtr;
308 typedef struct _QdEvent {
311 ScreenPtr pScreen; /* what screen the pointer was on */
312 unsigned long months; /* milliseconds is in the event */
317 #endif /* INPUTSTRUCT_H */