1 | /************************************************************
|
---|
2 |
|
---|
3 | Copyright 1987, 1998 The Open Group
|
---|
4 |
|
---|
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
|
---|
9 | documentation.
|
---|
10 |
|
---|
11 | The above copyright notice and this permission notice shall be included in
|
---|
12 | all copies or substantial portions of the Software.
|
---|
13 |
|
---|
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.
|
---|
20 |
|
---|
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.
|
---|
24 |
|
---|
25 |
|
---|
26 | Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
---|
27 |
|
---|
28 | All Rights Reserved
|
---|
29 |
|
---|
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.
|
---|
37 |
|
---|
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
|
---|
44 | SOFTWARE.
|
---|
45 |
|
---|
46 | ********************************************************/
|
---|
47 |
|
---|
48 |
|
---|
49 | #ifndef INPUTSTRUCT_H
|
---|
50 | #define INPUTSTRUCT_H
|
---|
51 |
|
---|
52 | #include "input.h"
|
---|
53 | #include "window.h"
|
---|
54 | #include "dixstruct.h"
|
---|
55 |
|
---|
56 | #define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
|
---|
57 |
|
---|
58 | #define SameClient(obj,client) \
|
---|
59 | (CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
|
---|
60 |
|
---|
61 | #define MAX_DEVICES 20
|
---|
62 |
|
---|
63 | #define EMASKSIZE MAX_DEVICES
|
---|
64 |
|
---|
65 | extern int CoreDevicePrivatesIndex;
|
---|
66 |
|
---|
67 | /* Kludge: OtherClients and InputClients must be compatible, see code */
|
---|
68 |
|
---|
69 | typedef struct _OtherClients {
|
---|
70 | OtherClientsPtr next;
|
---|
71 | XID resource; /* id for putting into resource manager */
|
---|
72 | Mask mask;
|
---|
73 | } OtherClients;
|
---|
74 |
|
---|
75 | typedef struct _InputClients {
|
---|
76 | InputClientsPtr next;
|
---|
77 | XID resource; /* id for putting into resource manager */
|
---|
78 | Mask mask[EMASKSIZE];
|
---|
79 | } InputClients;
|
---|
80 |
|
---|
81 | typedef struct _OtherInputMasks {
|
---|
82 | Mask deliverableEvents[EMASKSIZE];
|
---|
83 | Mask inputEvents[EMASKSIZE];
|
---|
84 | Mask dontPropagateMask[EMASKSIZE];
|
---|
85 | InputClientsPtr inputClients;
|
---|
86 | } OtherInputMasks;
|
---|
87 |
|
---|
88 | /*
|
---|
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.
|
---|
93 | */
|
---|
94 |
|
---|
95 | #define MasksPerDetailMask 8 /* 256 keycodes and 256 possible
|
---|
96 | modifier combinations, but only
|
---|
97 | 3 buttons. */
|
---|
98 |
|
---|
99 | typedef struct _DetailRec { /* Grab details may be bit masks */
|
---|
100 | unsigned short exact;
|
---|
101 | Mask *pMask;
|
---|
102 | } DetailRec;
|
---|
103 |
|
---|
104 | typedef struct _GrabRec {
|
---|
105 | GrabPtr next; /* for chain of passive grabs */
|
---|
106 | XID resource;
|
---|
107 | DeviceIntPtr device;
|
---|
108 | WindowPtr window;
|
---|
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 */
|
---|
120 | Mask eventMask;
|
---|
121 | } GrabRec;
|
---|
122 |
|
---|
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;
|
---|
133 | #ifdef XKB
|
---|
134 | struct _XkbSrvInfo *xkbInfo;
|
---|
135 | #else
|
---|
136 | void *pad0;
|
---|
137 | #endif
|
---|
138 | } KeyClassRec, *KeyClassPtr;
|
---|
139 |
|
---|
140 | typedef struct _AxisInfo {
|
---|
141 | int resolution;
|
---|
142 | int min_resolution;
|
---|
143 | int max_resolution;
|
---|
144 | int min_value;
|
---|
145 | int max_value;
|
---|
146 | } AxisInfo, *AxisInfoPtr;
|
---|
147 |
|
---|
148 | typedef struct _ValuatorClassRec {
|
---|
149 | ValuatorMotionProcPtr GetMotionProc;
|
---|
150 | int numMotionEvents;
|
---|
151 | int first_motion;
|
---|
152 | int last_motion;
|
---|
153 | void *motion;
|
---|
154 |
|
---|
155 | WindowPtr motionHintWindow;
|
---|
156 |
|
---|
157 | AxisInfoPtr axes;
|
---|
158 | unsigned short numAxes;
|
---|
159 | int *axisVal;
|
---|
160 | int lastx, lasty; /* last event recorded, not posted to
|
---|
161 | * client; see dix/devices.c */
|
---|
162 | int dxremaind, dyremaind; /* for acceleration */
|
---|
163 | CARD8 mode;
|
---|
164 | } ValuatorClassRec, *ValuatorClassPtr;
|
---|
165 |
|
---|
166 | typedef struct _ButtonClassRec {
|
---|
167 | CARD8 numButtons;
|
---|
168 | CARD8 buttonsDown; /* number of buttons currently down */
|
---|
169 | unsigned short state;
|
---|
170 | Mask motionMask;
|
---|
171 | CARD8 down[DOWN_LENGTH];
|
---|
172 | CARD8 map[MAP_LENGTH];
|
---|
173 | #ifdef XKB
|
---|
174 | union _XkbAction *xkb_acts;
|
---|
175 | #else
|
---|
176 | void *pad0;
|
---|
177 | #endif
|
---|
178 | } ButtonClassRec, *ButtonClassPtr;
|
---|
179 |
|
---|
180 | typedef struct _FocusClassRec {
|
---|
181 | WindowPtr win;
|
---|
182 | int revert;
|
---|
183 | TimeStamp time;
|
---|
184 | WindowPtr *trace;
|
---|
185 | int traceSize;
|
---|
186 | int traceGood;
|
---|
187 | } FocusClassRec, *FocusClassPtr;
|
---|
188 |
|
---|
189 | typedef struct _ProximityClassRec {
|
---|
190 | char pad;
|
---|
191 | } ProximityClassRec, *ProximityClassPtr;
|
---|
192 |
|
---|
193 | typedef struct _AbsoluteClassRec {
|
---|
194 | /* Calibration. */
|
---|
195 | int min_x;
|
---|
196 | int max_x;
|
---|
197 | int min_y;
|
---|
198 | int max_y;
|
---|
199 | int flip_x;
|
---|
200 | int flip_y;
|
---|
201 | int rotation;
|
---|
202 | int button_threshold;
|
---|
203 |
|
---|
204 | /* Area. */
|
---|
205 | int offset_x;
|
---|
206 | int offset_y;
|
---|
207 | int width;
|
---|
208 | int height;
|
---|
209 | int screen;
|
---|
210 | XID following;
|
---|
211 | } AbsoluteClassRec, *AbsoluteClassPtr;
|
---|
212 |
|
---|
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;
|
---|
219 |
|
---|
220 | typedef struct _KbdFeedbackClassRec {
|
---|
221 | BellProcPtr BellProc;
|
---|
222 | KbdCtrlProcPtr CtrlProc;
|
---|
223 | KeybdCtrl ctrl;
|
---|
224 | KbdFeedbackPtr next;
|
---|
225 | #ifdef XKB
|
---|
226 | struct _XkbSrvLedInfo *xkb_sli;
|
---|
227 | #else
|
---|
228 | void *pad0;
|
---|
229 | #endif
|
---|
230 | } KbdFeedbackClassRec;
|
---|
231 |
|
---|
232 | typedef struct _PtrFeedbackClassRec {
|
---|
233 | PtrCtrlProcPtr CtrlProc;
|
---|
234 | PtrCtrl ctrl;
|
---|
235 | PtrFeedbackPtr next;
|
---|
236 | } PtrFeedbackClassRec;
|
---|
237 |
|
---|
238 | typedef struct _IntegerFeedbackClassRec {
|
---|
239 | IntegerCtrlProcPtr CtrlProc;
|
---|
240 | IntegerCtrl ctrl;
|
---|
241 | IntegerFeedbackPtr next;
|
---|
242 | } IntegerFeedbackClassRec;
|
---|
243 |
|
---|
244 | typedef struct _StringFeedbackClassRec {
|
---|
245 | StringCtrlProcPtr CtrlProc;
|
---|
246 | StringCtrl ctrl;
|
---|
247 | StringFeedbackPtr next;
|
---|
248 | } StringFeedbackClassRec;
|
---|
249 |
|
---|
250 | typedef struct _BellFeedbackClassRec {
|
---|
251 | BellProcPtr BellProc;
|
---|
252 | BellCtrlProcPtr CtrlProc;
|
---|
253 | BellCtrl ctrl;
|
---|
254 | BellFeedbackPtr next;
|
---|
255 | } BellFeedbackClassRec;
|
---|
256 |
|
---|
257 | typedef struct _LedFeedbackClassRec {
|
---|
258 | LedCtrlProcPtr CtrlProc;
|
---|
259 | LedCtrl ctrl;
|
---|
260 | LedFeedbackPtr next;
|
---|
261 | #ifdef XKB
|
---|
262 | struct _XkbSrvLedInfo *xkb_sli;
|
---|
263 | #else
|
---|
264 | void *pad0;
|
---|
265 | #endif
|
---|
266 | } LedFeedbackClassRec;
|
---|
267 |
|
---|
268 | /* states for devices */
|
---|
269 |
|
---|
270 | #define NOT_GRABBED 0
|
---|
271 | #define THAWED 1
|
---|
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
|
---|
279 |
|
---|
280 | typedef struct _DeviceIntRec {
|
---|
281 | DeviceRec public;
|
---|
282 | DeviceIntPtr next;
|
---|
283 | TimeStamp grabTime;
|
---|
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 */
|
---|
293 | struct {
|
---|
294 | Bool frozen;
|
---|
295 | int state;
|
---|
296 | GrabPtr other; /* if other grab has this frozen */
|
---|
297 | xEvent *event; /* saved to be replayed */
|
---|
298 | int evcount;
|
---|
299 | } sync;
|
---|
300 | Atom type;
|
---|
301 | char *name;
|
---|
302 | CARD8 id;
|
---|
303 | CARD8 activatingKey;
|
---|
304 | Bool fromPassiveGrab;
|
---|
305 | GrabRec activeGrab;
|
---|
306 | void (*ActivateGrab) (
|
---|
307 | DeviceIntPtr /*device*/,
|
---|
308 | GrabPtr /*grab*/,
|
---|
309 | TimeStamp /*time*/,
|
---|
310 | Bool /*autoGrab*/);
|
---|
311 | void (*DeactivateGrab)(
|
---|
312 | DeviceIntPtr /*device*/);
|
---|
313 | KeyClassPtr key;
|
---|
314 | ValuatorClassPtr valuator;
|
---|
315 | ButtonClassPtr button;
|
---|
316 | FocusClassPtr focus;
|
---|
317 | ProximityClassPtr proximity;
|
---|
318 | AbsoluteClassPtr absolute;
|
---|
319 | KbdFeedbackPtr kbdfeed;
|
---|
320 | PtrFeedbackPtr ptrfeed;
|
---|
321 | IntegerFeedbackPtr intfeed;
|
---|
322 | StringFeedbackPtr stringfeed;
|
---|
323 | BellFeedbackPtr bell;
|
---|
324 | LedFeedbackPtr leds;
|
---|
325 | #ifdef XKB
|
---|
326 | struct _XkbInterest *xkb_interest;
|
---|
327 | #else
|
---|
328 | void *pad0;
|
---|
329 | #endif
|
---|
330 | char *config_info; /* used by the hotplug layer */
|
---|
331 | DevUnion *devPrivates;
|
---|
332 | int nPrivates;
|
---|
333 | DeviceUnwrapProc unwrapProc;
|
---|
334 | } DeviceIntRec;
|
---|
335 |
|
---|
336 | typedef struct {
|
---|
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;
|
---|
342 | } InputInfo;
|
---|
343 |
|
---|
344 | extern InputInfo inputInfo;
|
---|
345 |
|
---|
346 | /* for keeping the events for devices grabbed synchronously */
|
---|
347 | typedef struct _QdEvent *QdEventPtr;
|
---|
348 | typedef struct _QdEvent {
|
---|
349 | QdEventPtr next;
|
---|
350 | DeviceIntPtr device;
|
---|
351 | ScreenPtr pScreen; /* what screen the pointer was on */
|
---|
352 | unsigned long months; /* milliseconds is in the event */
|
---|
353 | xEvent *event;
|
---|
354 | int evcount;
|
---|
355 | } QdEventRec;
|
---|
356 |
|
---|
357 | #endif /* INPUTSTRUCT_H */
|
---|