1 /************************************************************
3 Copyright 1987, 1998 The Open Group
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
26 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
30 Permission to use, copy, modify, and distribute this software and its
31 documentation for any purpose and without fee is hereby granted,
32 provided that the above copyright notice appear in all copies and that
33 both that copyright notice and this permission notice appear in
34 supporting documentation, and that the name of Digital not be
35 used in advertising or publicity pertaining to distribution of the
36 software without specific, written prior permission.
38 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
46 ********************************************************/
54 #include "dixstruct.h"
56 #define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
58 #define SameClient(obj,client) \
59 (CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
61 #define MAX_DEVICES 20
63 #define EMASKSIZE MAX_DEVICES
65 extern int CoreDevicePrivatesIndex
;
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 CARD8 postdown
[DOWN_LENGTH
];
126 KeyCode
*modifierKeyMap
;
127 KeySymsRec curKeySyms
;
128 int modifierKeyCount
[8];
129 CARD8 modifierMap
[MAP_LENGTH
];
130 CARD8 maxKeysPerModifier
;
131 unsigned short state
;
132 unsigned short prev_state
;
134 struct _XkbSrvInfo
*xkbInfo
;
138 } KeyClassRec
, *KeyClassPtr
;
140 typedef struct _AxisInfo
{
146 } AxisInfo
, *AxisInfoPtr
;
148 typedef struct _ValuatorClassRec
{
149 ValuatorMotionProcPtr GetMotionProc
;
155 WindowPtr motionHintWindow
;
158 unsigned short numAxes
;
160 int lastx
, lasty
; /* last event recorded, not posted to
161 * client; see dix/devices.c */
162 int dxremaind
, dyremaind
; /* for acceleration */
164 } ValuatorClassRec
, *ValuatorClassPtr
;
166 typedef struct _ButtonClassRec
{
168 CARD8 buttonsDown
; /* number of buttons currently down */
169 unsigned short state
;
171 CARD8 down
[DOWN_LENGTH
];
172 CARD8 map
[MAP_LENGTH
];
174 union _XkbAction
*xkb_acts
;
178 } ButtonClassRec
, *ButtonClassPtr
;
180 typedef struct _FocusClassRec
{
187 } FocusClassRec
, *FocusClassPtr
;
189 typedef struct _ProximityClassRec
{
191 } ProximityClassRec
, *ProximityClassPtr
;
193 typedef struct _AbsoluteClassRec
{
202 int button_threshold
;
211 } AbsoluteClassRec
, *AbsoluteClassPtr
;
213 typedef struct _KbdFeedbackClassRec
*KbdFeedbackPtr
;
214 typedef struct _PtrFeedbackClassRec
*PtrFeedbackPtr
;
215 typedef struct _IntegerFeedbackClassRec
*IntegerFeedbackPtr
;
216 typedef struct _StringFeedbackClassRec
*StringFeedbackPtr
;
217 typedef struct _BellFeedbackClassRec
*BellFeedbackPtr
;
218 typedef struct _LedFeedbackClassRec
*LedFeedbackPtr
;
220 typedef struct _KbdFeedbackClassRec
{
221 BellProcPtr BellProc
;
222 KbdCtrlProcPtr CtrlProc
;
226 struct _XkbSrvLedInfo
*xkb_sli
;
230 } KbdFeedbackClassRec
;
232 typedef struct _PtrFeedbackClassRec
{
233 PtrCtrlProcPtr CtrlProc
;
236 } PtrFeedbackClassRec
;
238 typedef struct _IntegerFeedbackClassRec
{
239 IntegerCtrlProcPtr CtrlProc
;
241 IntegerFeedbackPtr next
;
242 } IntegerFeedbackClassRec
;
244 typedef struct _StringFeedbackClassRec
{
245 StringCtrlProcPtr CtrlProc
;
247 StringFeedbackPtr next
;
248 } StringFeedbackClassRec
;
250 typedef struct _BellFeedbackClassRec
{
251 BellProcPtr BellProc
;
252 BellCtrlProcPtr CtrlProc
;
254 BellFeedbackPtr next
;
255 } BellFeedbackClassRec
;
257 typedef struct _LedFeedbackClassRec
{
258 LedCtrlProcPtr CtrlProc
;
262 struct _XkbSrvLedInfo
*xkb_sli
;
266 } LedFeedbackClassRec
;
268 /* states for devices */
270 #define NOT_GRABBED 0
272 #define THAWED_BOTH 2 /* not a real state */
273 #define FREEZE_NEXT_EVENT 3
274 #define FREEZE_BOTH_NEXT_EVENT 4
275 #define FROZEN 5 /* any state >= has device frozen */
276 #define FROZEN_NO_EVENT 5
277 #define FROZEN_WITH_EVENT 6
278 #define THAW_OTHERS 7
280 typedef struct _DeviceIntRec
{
284 Bool startup
; /* true if needs to be turned on at
285 server intialization time */
286 DeviceProc deviceProc
; /* proc(DevicePtr, DEVICE_xx). It is
287 used to initialize, turn on, or
288 turn off the device */
289 Bool inited
; /* TRUE if INIT returns Success */
290 Bool enabled
; /* TRUE if ON returns Success */
291 Bool coreEvents
; /* TRUE if device also sends core */
292 GrabPtr grab
; /* the grabber - used by DIX */
296 GrabPtr other
; /* if other grab has this frozen */
297 xEvent
*event
; /* saved to be replayed */
304 Bool fromPassiveGrab
;
306 void (*ActivateGrab
) (
307 DeviceIntPtr
/*device*/,
311 void (*DeactivateGrab
)(
312 DeviceIntPtr
/*device*/);
314 ValuatorClassPtr valuator
;
315 ButtonClassPtr button
;
317 ProximityClassPtr proximity
;
318 AbsoluteClassPtr absolute
;
319 KbdFeedbackPtr kbdfeed
;
320 PtrFeedbackPtr ptrfeed
;
321 IntegerFeedbackPtr intfeed
;
322 StringFeedbackPtr stringfeed
;
323 BellFeedbackPtr bell
;
326 struct _XkbInterest
*xkb_interest
;
330 char *config_info
; /* used by the hotplug layer */
331 DevUnion
*devPrivates
;
333 DeviceUnwrapProc unwrapProc
;
337 int numDevices
; /* total number of devices */
338 DeviceIntPtr devices
; /* all devices turned on */
339 DeviceIntPtr off_devices
; /* all devices turned off */
340 DeviceIntPtr keyboard
; /* the main one for the server */
341 DeviceIntPtr pointer
;
344 extern InputInfo inputInfo
;
346 /* for keeping the events for devices grabbed synchronously */
347 typedef struct _QdEvent
*QdEventPtr
;
348 typedef struct _QdEvent
{
351 ScreenPtr pScreen
; /* what screen the pointer was on */
352 unsigned long months
; /* milliseconds is in the event */
357 #endif /* INPUTSTRUCT_H */