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"
57
#define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
59
#define SameClient(obj,client) \
60
(CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
62
#define MAX_DEVICES 20
64
#define EMASKSIZE MAX_DEVICES
66
extern DevPrivateKey CoreDevicePrivateKey;
68
/* Kludge: OtherClients and InputClients must be compatible, see code */
70
typedef struct _OtherClients {
72
XID resource; /* id for putting into resource manager */
76
typedef struct _InputClients {
78
XID resource; /* id for putting into resource manager */
82
typedef struct _OtherInputMasks {
83
Mask deliverableEvents[EMASKSIZE];
84
Mask inputEvents[EMASKSIZE];
85
Mask dontPropagateMask[EMASKSIZE];
86
InputClientsPtr inputClients;
90
* The following structure gets used for both active and passive grabs. For
91
* active grabs some of the fields (e.g. modifiers) are not used. However,
92
* that is not much waste since there aren't many active grabs (one per
93
* keyboard/pointer device) going at once in the server.
96
#define MasksPerDetailMask 8 /* 256 keycodes and 256 possible
97
modifier combinations, but only
100
typedef struct _DetailRec { /* Grab details may be bit masks */
101
unsigned short exact;
105
typedef struct _GrabRec {
106
GrabPtr next; /* for chain of passive grabs */
110
unsigned ownerEvents:1;
111
unsigned keyboardMode:1;
112
unsigned pointerMode:1;
113
unsigned coreGrab:1; /* grab is on core device */
114
unsigned coreMods:1; /* modifiers are on core keyboard */
115
CARD8 type; /* event type */
116
DetailRec modifiersDetail;
117
DeviceIntPtr modifierDevice;
118
DetailRec detail; /* key or button */
119
WindowPtr confineTo; /* always NULL for keyboards */
120
CursorPtr cursor; /* always NULL for keyboards */
124
typedef struct _KeyClassRec {
125
CARD8 down[DOWN_LENGTH];
126
CARD8 postdown[DOWN_LENGTH];
127
KeyCode *modifierKeyMap;
128
KeySymsRec curKeySyms;
129
int modifierKeyCount[8];
130
CARD8 modifierMap[MAP_LENGTH];
131
CARD8 maxKeysPerModifier;
132
unsigned short state;
133
unsigned short prev_state;
135
struct _XkbSrvInfo *xkbInfo;
139
} KeyClassRec, *KeyClassPtr;
141
typedef struct _AxisInfo {
147
} AxisInfo, *AxisInfoPtr;
149
typedef struct _ValuatorClassRec {
150
ValuatorMotionProcPtr GetMotionProc;
156
WindowPtr motionHintWindow;
159
unsigned short numAxes;
161
int lastx, lasty; /* last event recorded, not posted to
162
* client; see dix/devices.c */
163
float dxremaind, dyremaind; /* for acceleration */
165
} ValuatorClassRec, *ValuatorClassPtr;
167
typedef struct _ButtonClassRec {
169
CARD8 buttonsDown; /* number of buttons currently down */
170
unsigned short state;
172
CARD8 down[DOWN_LENGTH];
173
CARD8 map[MAP_LENGTH];
175
union _XkbAction *xkb_acts;
179
} ButtonClassRec, *ButtonClassPtr;
181
typedef struct _FocusClassRec {
188
} FocusClassRec, *FocusClassPtr;
190
typedef struct _ProximityClassRec {
192
} ProximityClassRec, *ProximityClassPtr;
194
typedef struct _AbsoluteClassRec {
203
int button_threshold;
212
} AbsoluteClassRec, *AbsoluteClassPtr;
214
typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr;
215
typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr;
216
typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr;
217
typedef struct _StringFeedbackClassRec *StringFeedbackPtr;
218
typedef struct _BellFeedbackClassRec *BellFeedbackPtr;
219
typedef struct _LedFeedbackClassRec *LedFeedbackPtr;
221
typedef struct _KbdFeedbackClassRec {
222
BellProcPtr BellProc;
223
KbdCtrlProcPtr CtrlProc;
227
struct _XkbSrvLedInfo *xkb_sli;
231
} KbdFeedbackClassRec;
233
typedef struct _PtrFeedbackClassRec {
234
PtrCtrlProcPtr CtrlProc;
237
} PtrFeedbackClassRec;
239
typedef struct _IntegerFeedbackClassRec {
240
IntegerCtrlProcPtr CtrlProc;
242
IntegerFeedbackPtr next;
243
} IntegerFeedbackClassRec;
245
typedef struct _StringFeedbackClassRec {
246
StringCtrlProcPtr CtrlProc;
248
StringFeedbackPtr next;
249
} StringFeedbackClassRec;
251
typedef struct _BellFeedbackClassRec {
252
BellProcPtr BellProc;
253
BellCtrlProcPtr CtrlProc;
255
BellFeedbackPtr next;
256
} BellFeedbackClassRec;
258
typedef struct _LedFeedbackClassRec {
259
LedCtrlProcPtr CtrlProc;
263
struct _XkbSrvLedInfo *xkb_sli;
267
} LedFeedbackClassRec;
269
/* states for devices */
271
#define NOT_GRABBED 0
273
#define THAWED_BOTH 2 /* not a real state */
274
#define FREEZE_NEXT_EVENT 3
275
#define FREEZE_BOTH_NEXT_EVENT 4
276
#define FROZEN 5 /* any state >= has device frozen */
277
#define FROZEN_NO_EVENT 5
278
#define FROZEN_WITH_EVENT 6
279
#define THAW_OTHERS 7
281
typedef struct _DeviceIntRec {
285
Bool startup; /* true if needs to be turned on at
286
server intialization time */
287
DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is
288
used to initialize, turn on, or
289
turn off the device */
290
Bool inited; /* TRUE if INIT returns Success */
291
Bool enabled; /* TRUE if ON returns Success */
292
Bool coreEvents; /* TRUE if device also sends core */
293
GrabPtr grab; /* the grabber - used by DIX */
297
GrabPtr other; /* if other grab has this frozen */
298
xEvent *event; /* saved to be replayed */
305
Bool fromPassiveGrab;
307
void (*ActivateGrab) (
308
DeviceIntPtr /*device*/,
312
void (*DeactivateGrab)(
313
DeviceIntPtr /*device*/);
315
ValuatorClassPtr valuator;
316
ButtonClassPtr button;
318
ProximityClassPtr proximity;
319
AbsoluteClassPtr absolute;
320
KbdFeedbackPtr kbdfeed;
321
PtrFeedbackPtr ptrfeed;
322
IntegerFeedbackPtr intfeed;
323
StringFeedbackPtr stringfeed;
324
BellFeedbackPtr bell;
327
struct _XkbInterest *xkb_interest;
331
char *config_info; /* used by the hotplug layer */
332
PrivateRec *devPrivates;
334
DeviceUnwrapProc unwrapProc;
338
int numDevices; /* total number of devices */
339
DeviceIntPtr devices; /* all devices turned on */
340
DeviceIntPtr off_devices; /* all devices turned off */
341
DeviceIntPtr keyboard; /* the main one for the server */
342
DeviceIntPtr pointer;
345
extern InputInfo inputInfo;
347
/* for keeping the events for devices grabbed synchronously */
348
typedef struct _QdEvent *QdEventPtr;
349
typedef struct _QdEvent {
352
ScreenPtr pScreen; /* what screen the pointer was on */
353
unsigned long months; /* milliseconds is in the event */
358
#endif /* INPUTSTRUCT_H */