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 | #include "cursorstr.h"
|
---|
56 | #include "geext.h"
|
---|
57 | #include "privates.h"
|
---|
58 |
|
---|
59 | #define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
|
---|
60 | #define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7)))
|
---|
61 | #define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7)))
|
---|
62 |
|
---|
63 | #define SameClient(obj,client) \
|
---|
64 | (CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
|
---|
65 |
|
---|
66 | #define EMASKSIZE MAXDEVICES + 2
|
---|
67 |
|
---|
68 | /* This is the last XI2 event supported by the server. If you add
|
---|
69 | * events to the protocol, the server will not support these events until
|
---|
70 | * this number here is bumped.
|
---|
71 | */
|
---|
72 | #define XI2LASTEVENT 17 /* XI_RawMotion */
|
---|
73 | #define XI2MASKSIZE ((XI2LASTEVENT + 7)/8) /* no of bits for masks */
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * This struct stores the core event mask for each client except the client
|
---|
77 | * that created the window.
|
---|
78 | *
|
---|
79 | * Each window that has events selected from other clients has at least one of
|
---|
80 | * these masks. If multiple clients selected for events on the same window,
|
---|
81 | * these masks are in a linked list.
|
---|
82 | *
|
---|
83 | * The event mask for the client that created the window is stored in
|
---|
84 | * win->eventMask instead.
|
---|
85 | *
|
---|
86 | * The resource id is simply a fake client ID to associate this mask with a
|
---|
87 | * client.
|
---|
88 | *
|
---|
89 | * Kludge: OtherClients and InputClients must be compatible, see code.
|
---|
90 | */
|
---|
91 | typedef struct _OtherClients {
|
---|
92 | OtherClientsPtr next; /**< Pointer to the next mask */
|
---|
93 | XID resource; /**< id for putting into resource manager */
|
---|
94 | Mask mask; /**< Core event mask */
|
---|
95 | } OtherClients;
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * This struct stores the XI event mask for each client.
|
---|
99 | *
|
---|
100 | * Each window that has events selected has at least one of these masks. If
|
---|
101 | * multiple client selected for events on the same window, these masks are in
|
---|
102 | * a linked list.
|
---|
103 | */
|
---|
104 | typedef struct _InputClients {
|
---|
105 | InputClientsPtr next; /**< Pointer to the next mask */
|
---|
106 | XID resource; /**< id for putting into resource manager */
|
---|
107 | Mask mask[EMASKSIZE]; /**< Actual XI event mask, deviceid is index */
|
---|
108 | /** XI2 event masks. One per device, each bit is a mask of (1 << type) */
|
---|
109 | unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE];
|
---|
110 | } InputClients;
|
---|
111 |
|
---|
112 | /**
|
---|
113 | * Combined XI event masks from all devices.
|
---|
114 | *
|
---|
115 | * This is the XI equivalent of the deliverableEvents, eventMask and
|
---|
116 | * dontPropagate mask of the WindowRec (or WindowOptRec).
|
---|
117 | *
|
---|
118 | * A window that has an XI client selecting for events has exactly one
|
---|
119 | * OtherInputMasks struct and exactly one InputClients struct hanging off
|
---|
120 | * inputClients. Each further client appends to the inputClients list.
|
---|
121 | * Each Mask field is per-device, with the device id as the index.
|
---|
122 | * Exception: for non-device events (Presence events), the MAXDEVICES
|
---|
123 | * deviceid is used.
|
---|
124 | */
|
---|
125 | typedef struct _OtherInputMasks {
|
---|
126 | /**
|
---|
127 | * Bitwise OR of all masks by all clients and the window's parent's masks.
|
---|
128 | */
|
---|
129 | Mask deliverableEvents[EMASKSIZE];
|
---|
130 | /**
|
---|
131 | * Bitwise OR of all masks by all clients on this window.
|
---|
132 | */
|
---|
133 | Mask inputEvents[EMASKSIZE];
|
---|
134 | /** The do-not-propagate masks for each device. */
|
---|
135 | Mask dontPropagateMask[EMASKSIZE];
|
---|
136 | /** The clients that selected for events */
|
---|
137 | InputClientsPtr inputClients;
|
---|
138 | /* XI2 event masks. One per device, each bit is a mask of (1 << type) */
|
---|
139 | unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE];
|
---|
140 | } OtherInputMasks;
|
---|
141 |
|
---|
142 | /*
|
---|
143 | * The following structure gets used for both active and passive grabs. For
|
---|
144 | * active grabs some of the fields (e.g. modifiers) are not used. However,
|
---|
145 | * that is not much waste since there aren't many active grabs (one per
|
---|
146 | * keyboard/pointer device) going at once in the server.
|
---|
147 | */
|
---|
148 |
|
---|
149 | #define MasksPerDetailMask 8 /* 256 keycodes and 256 possible
|
---|
150 | modifier combinations, but only
|
---|
151 | 3 buttons. */
|
---|
152 |
|
---|
153 | typedef struct _DetailRec { /* Grab details may be bit masks */
|
---|
154 | unsigned int exact;
|
---|
155 | Mask *pMask;
|
---|
156 | } DetailRec;
|
---|
157 |
|
---|
158 | typedef enum {
|
---|
159 | GRABTYPE_CORE,
|
---|
160 | GRABTYPE_XI,
|
---|
161 | GRABTYPE_XI2
|
---|
162 | } GrabType;
|
---|
163 |
|
---|
164 | union _GrabMask {
|
---|
165 | Mask core;
|
---|
166 | Mask xi;
|
---|
167 | char xi2mask[EMASKSIZE][XI2MASKSIZE];
|
---|
168 | };
|
---|
169 |
|
---|
170 | /**
|
---|
171 | * Central struct for device grabs.
|
---|
172 | * The same struct is used for both core grabs and device grabs, with
|
---|
173 | * different fields being set.
|
---|
174 | * If the grab is a core grab (GrabPointer/GrabKeyboard), then the eventMask
|
---|
175 | * is a combination of standard event masks (i.e. PointerMotionMask |
|
---|
176 | * ButtonPressMask).
|
---|
177 | * If the grab is a device grab (GrabDevice), then the eventMask is a
|
---|
178 | * combination of event masks for a given XI event type (see SetEventInfo).
|
---|
179 | *
|
---|
180 | * If the grab is a result of a ButtonPress, then eventMask is the core mask
|
---|
181 | * and deviceMask is set to the XI event mask for the grab.
|
---|
182 | */
|
---|
183 | typedef struct _GrabRec {
|
---|
184 | GrabPtr next; /* for chain of passive grabs */
|
---|
185 | XID resource;
|
---|
186 | DeviceIntPtr device;
|
---|
187 | WindowPtr window;
|
---|
188 | unsigned ownerEvents:1;
|
---|
189 | unsigned keyboardMode:1;
|
---|
190 | unsigned pointerMode:1;
|
---|
191 | GrabType grabtype;
|
---|
192 | CARD8 type; /* event type */
|
---|
193 | DetailRec modifiersDetail;
|
---|
194 | DeviceIntPtr modifierDevice;
|
---|
195 | DetailRec detail; /* key or button */
|
---|
196 | WindowPtr confineTo; /* always NULL for keyboards */
|
---|
197 | CursorPtr cursor; /* always NULL for keyboards */
|
---|
198 | Mask eventMask;
|
---|
199 | Mask deviceMask;
|
---|
200 | /* XI2 event masks. One per device, each bit is a mask of (1 << type) */
|
---|
201 | unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE];
|
---|
202 | } GrabRec;
|
---|
203 |
|
---|
204 | typedef struct _KeyClassRec {
|
---|
205 | int sourceid;
|
---|
206 | CARD8 down[DOWN_LENGTH];
|
---|
207 | CARD8 postdown[DOWN_LENGTH];
|
---|
208 | int modifierKeyCount[8];
|
---|
209 | struct _XkbSrvInfo *xkbInfo;
|
---|
210 | } KeyClassRec, *KeyClassPtr;
|
---|
211 |
|
---|
212 | typedef struct _AxisInfo {
|
---|
213 | int resolution;
|
---|
214 | int min_resolution;
|
---|
215 | int max_resolution;
|
---|
216 | int min_value;
|
---|
217 | int max_value;
|
---|
218 | Atom label;
|
---|
219 | } AxisInfo, *AxisInfoPtr;
|
---|
220 |
|
---|
221 | typedef struct _ValuatorAccelerationRec {
|
---|
222 | int number;
|
---|
223 | PointerAccelSchemeProc AccelSchemeProc;
|
---|
224 | void *accelData; /* at disposal of AccelScheme */
|
---|
225 | DeviceCallbackProc AccelCleanupProc;
|
---|
226 | } ValuatorAccelerationRec, *ValuatorAccelerationPtr;
|
---|
227 |
|
---|
228 | typedef struct _ValuatorClassRec {
|
---|
229 | int sourceid;
|
---|
230 | int numMotionEvents;
|
---|
231 | int first_motion;
|
---|
232 | int last_motion;
|
---|
233 | void *motion; /* motion history buffer. Different layout
|
---|
234 | for MDs and SDs!*/
|
---|
235 | WindowPtr motionHintWindow;
|
---|
236 |
|
---|
237 | AxisInfoPtr axes;
|
---|
238 | unsigned short numAxes;
|
---|
239 | double *axisVal; /* always absolute, but device-coord system */
|
---|
240 | CARD8 mode;
|
---|
241 | ValuatorAccelerationRec accelScheme;
|
---|
242 | } ValuatorClassRec, *ValuatorClassPtr;
|
---|
243 |
|
---|
244 | typedef struct _ButtonClassRec {
|
---|
245 | int sourceid;
|
---|
246 | CARD8 numButtons;
|
---|
247 | CARD8 buttonsDown; /* number of buttons currently down
|
---|
248 | This counts logical buttons, not
|
---|
249 | physical ones, i.e if some buttons
|
---|
250 | are mapped to 0, they're not counted
|
---|
251 | here */
|
---|
252 | unsigned short state;
|
---|
253 | Mask motionMask;
|
---|
254 | CARD8 down[DOWN_LENGTH];
|
---|
255 | CARD8 postdown[DOWN_LENGTH];
|
---|
256 | CARD8 map[MAP_LENGTH];
|
---|
257 | union _XkbAction *xkb_acts;
|
---|
258 | Atom labels[MAX_BUTTONS];
|
---|
259 | } ButtonClassRec, *ButtonClassPtr;
|
---|
260 |
|
---|
261 | typedef struct _FocusClassRec {
|
---|
262 | int sourceid;
|
---|
263 | WindowPtr win; /* May be set to a int constant (e.g. PointerRootWin)! */
|
---|
264 | int revert;
|
---|
265 | TimeStamp time;
|
---|
266 | WindowPtr *trace;
|
---|
267 | int traceSize;
|
---|
268 | int traceGood;
|
---|
269 | } FocusClassRec, *FocusClassPtr;
|
---|
270 |
|
---|
271 | typedef struct _ProximityClassRec {
|
---|
272 | int sourceid;
|
---|
273 | char pad;
|
---|
274 | } ProximityClassRec, *ProximityClassPtr;
|
---|
275 |
|
---|
276 | typedef struct _AbsoluteClassRec {
|
---|
277 | int sourceid;
|
---|
278 | /* Calibration. */
|
---|
279 | int min_x;
|
---|
280 | int max_x;
|
---|
281 | int min_y;
|
---|
282 | int max_y;
|
---|
283 | int flip_x;
|
---|
284 | int flip_y;
|
---|
285 | int rotation;
|
---|
286 | int button_threshold;
|
---|
287 |
|
---|
288 | /* Area. */
|
---|
289 | int offset_x;
|
---|
290 | int offset_y;
|
---|
291 | int width;
|
---|
292 | int height;
|
---|
293 | int screen;
|
---|
294 | XID following;
|
---|
295 | } AbsoluteClassRec, *AbsoluteClassPtr;
|
---|
296 |
|
---|
297 | typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr;
|
---|
298 | typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr;
|
---|
299 | typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr;
|
---|
300 | typedef struct _StringFeedbackClassRec *StringFeedbackPtr;
|
---|
301 | typedef struct _BellFeedbackClassRec *BellFeedbackPtr;
|
---|
302 | typedef struct _LedFeedbackClassRec *LedFeedbackPtr;
|
---|
303 |
|
---|
304 | typedef struct _KbdFeedbackClassRec {
|
---|
305 | BellProcPtr BellProc;
|
---|
306 | KbdCtrlProcPtr CtrlProc;
|
---|
307 | KeybdCtrl ctrl;
|
---|
308 | KbdFeedbackPtr next;
|
---|
309 | struct _XkbSrvLedInfo *xkb_sli;
|
---|
310 | } KbdFeedbackClassRec;
|
---|
311 |
|
---|
312 | typedef struct _PtrFeedbackClassRec {
|
---|
313 | PtrCtrlProcPtr CtrlProc;
|
---|
314 | PtrCtrl ctrl;
|
---|
315 | PtrFeedbackPtr next;
|
---|
316 | } PtrFeedbackClassRec;
|
---|
317 |
|
---|
318 | typedef struct _IntegerFeedbackClassRec {
|
---|
319 | IntegerCtrlProcPtr CtrlProc;
|
---|
320 | IntegerCtrl ctrl;
|
---|
321 | IntegerFeedbackPtr next;
|
---|
322 | } IntegerFeedbackClassRec;
|
---|
323 |
|
---|
324 | typedef struct _StringFeedbackClassRec {
|
---|
325 | StringCtrlProcPtr CtrlProc;
|
---|
326 | StringCtrl ctrl;
|
---|
327 | StringFeedbackPtr next;
|
---|
328 | } StringFeedbackClassRec;
|
---|
329 |
|
---|
330 | typedef struct _BellFeedbackClassRec {
|
---|
331 | BellProcPtr BellProc;
|
---|
332 | BellCtrlProcPtr CtrlProc;
|
---|
333 | BellCtrl ctrl;
|
---|
334 | BellFeedbackPtr next;
|
---|
335 | } BellFeedbackClassRec;
|
---|
336 |
|
---|
337 | typedef struct _LedFeedbackClassRec {
|
---|
338 | LedCtrlProcPtr CtrlProc;
|
---|
339 | LedCtrl ctrl;
|
---|
340 | LedFeedbackPtr next;
|
---|
341 | struct _XkbSrvLedInfo *xkb_sli;
|
---|
342 | } LedFeedbackClassRec;
|
---|
343 |
|
---|
344 |
|
---|
345 | typedef struct _ClassesRec {
|
---|
346 | KeyClassPtr key;
|
---|
347 | ValuatorClassPtr valuator;
|
---|
348 | ButtonClassPtr button;
|
---|
349 | FocusClassPtr focus;
|
---|
350 | ProximityClassPtr proximity;
|
---|
351 | AbsoluteClassPtr absolute;
|
---|
352 | KbdFeedbackPtr kbdfeed;
|
---|
353 | PtrFeedbackPtr ptrfeed;
|
---|
354 | IntegerFeedbackPtr intfeed;
|
---|
355 | StringFeedbackPtr stringfeed;
|
---|
356 | BellFeedbackPtr bell;
|
---|
357 | LedFeedbackPtr leds;
|
---|
358 | } ClassesRec;
|
---|
359 |
|
---|
360 |
|
---|
361 | /**
|
---|
362 | * Sprite information for a device.
|
---|
363 | */
|
---|
364 | typedef struct {
|
---|
365 | CursorPtr current;
|
---|
366 | BoxRec hotLimits; /* logical constraints of hot spot */
|
---|
367 | Bool confined; /* confined to screen */
|
---|
368 | RegionPtr hotShape; /* additional logical shape constraint */
|
---|
369 | BoxRec physLimits; /* physical constraints of hot spot */
|
---|
370 | WindowPtr win; /* window of logical position */
|
---|
371 | HotSpot hot; /* logical pointer position */
|
---|
372 | HotSpot hotPhys; /* physical pointer position */
|
---|
373 | #ifdef PANORAMIX
|
---|
374 | ScreenPtr screen; /* all others are in Screen 0 coordinates */
|
---|
375 | RegionRec Reg1; /* Region 1 for confining motion */
|
---|
376 | RegionRec Reg2; /* Region 2 for confining virtual motion */
|
---|
377 | WindowPtr windows[MAXSCREENS];
|
---|
378 | WindowPtr confineWin; /* confine window */
|
---|
379 | #endif
|
---|
380 | /* The window trace information is used at dix/events.c to avoid having
|
---|
381 | * to compute all the windows between the root and the current pointer
|
---|
382 | * window each time a button or key goes down. The grabs on each of those
|
---|
383 | * windows must be checked.
|
---|
384 | * spriteTraces should only be used at dix/events.c! */
|
---|
385 | WindowPtr *spriteTrace;
|
---|
386 | int spriteTraceSize;
|
---|
387 | int spriteTraceGood;
|
---|
388 |
|
---|
389 | /* Due to delays between event generation and event processing, it is
|
---|
390 | * possible that the pointer has crossed screen boundaries between the
|
---|
391 | * time in which it begins generating events and the time when
|
---|
392 | * those events are processed.
|
---|
393 | *
|
---|
394 | * pEnqueueScreen: screen the pointer was on when the event was generated
|
---|
395 | * pDequeueScreen: screen the pointer was on when the event is processed
|
---|
396 | */
|
---|
397 | ScreenPtr pEnqueueScreen;
|
---|
398 | ScreenPtr pDequeueScreen;
|
---|
399 |
|
---|
400 | } SpriteRec, *SpritePtr;
|
---|
401 |
|
---|
402 | /* Device properties */
|
---|
403 | typedef struct _XIPropertyValue
|
---|
404 | {
|
---|
405 | Atom type; /* ignored by server */
|
---|
406 | short format; /* format of data for swapping - 8,16,32 */
|
---|
407 | long size; /* size of data in (format/8) bytes */
|
---|
408 | pointer data; /* private to client */
|
---|
409 | } XIPropertyValueRec;
|
---|
410 |
|
---|
411 | typedef struct _XIProperty
|
---|
412 | {
|
---|
413 | struct _XIProperty *next;
|
---|
414 | Atom propertyName;
|
---|
415 | BOOL deletable; /* clients can delete this prop? */
|
---|
416 | XIPropertyValueRec value;
|
---|
417 | } XIPropertyRec;
|
---|
418 |
|
---|
419 | typedef XIPropertyRec *XIPropertyPtr;
|
---|
420 | typedef XIPropertyValueRec *XIPropertyValuePtr;
|
---|
421 |
|
---|
422 |
|
---|
423 | typedef struct _XIPropertyHandler
|
---|
424 | {
|
---|
425 | struct _XIPropertyHandler* next;
|
---|
426 | long id;
|
---|
427 | int (*SetProperty) (DeviceIntPtr dev,
|
---|
428 | Atom property,
|
---|
429 | XIPropertyValuePtr prop,
|
---|
430 | BOOL checkonly);
|
---|
431 | int (*GetProperty) (DeviceIntPtr dev,
|
---|
432 | Atom property);
|
---|
433 | int (*DeleteProperty) (DeviceIntPtr dev,
|
---|
434 | Atom property);
|
---|
435 | } XIPropertyHandler, *XIPropertyHandlerPtr;
|
---|
436 |
|
---|
437 | /* states for devices */
|
---|
438 |
|
---|
439 | #define NOT_GRABBED 0
|
---|
440 | #define THAWED 1
|
---|
441 | #define THAWED_BOTH 2 /* not a real state */
|
---|
442 | #define FREEZE_NEXT_EVENT 3
|
---|
443 | #define FREEZE_BOTH_NEXT_EVENT 4
|
---|
444 | #define FROZEN 5 /* any state >= has device frozen */
|
---|
445 | #define FROZEN_NO_EVENT 5
|
---|
446 | #define FROZEN_WITH_EVENT 6
|
---|
447 | #define THAW_OTHERS 7
|
---|
448 |
|
---|
449 |
|
---|
450 | typedef struct _GrabInfoRec {
|
---|
451 | TimeStamp grabTime;
|
---|
452 | Bool fromPassiveGrab; /* true if from passive grab */
|
---|
453 | Bool implicitGrab; /* implicit from ButtonPress */
|
---|
454 | GrabRec activeGrab;
|
---|
455 | GrabPtr grab;
|
---|
456 | CARD8 activatingKey;
|
---|
457 | void (*ActivateGrab) (
|
---|
458 | DeviceIntPtr /*device*/,
|
---|
459 | GrabPtr /*grab*/,
|
---|
460 | TimeStamp /*time*/,
|
---|
461 | Bool /*autoGrab*/);
|
---|
462 | void (*DeactivateGrab)(
|
---|
463 | DeviceIntPtr /*device*/);
|
---|
464 | struct {
|
---|
465 | Bool frozen;
|
---|
466 | int state;
|
---|
467 | GrabPtr other; /* if other grab has this frozen */
|
---|
468 | DeviceEvent *event; /* saved to be replayed */
|
---|
469 | } sync;
|
---|
470 | } GrabInfoRec, *GrabInfoPtr;
|
---|
471 |
|
---|
472 | typedef struct _SpriteInfoRec {
|
---|
473 | /* sprite must always point to a valid sprite. For devices sharing the
|
---|
474 | * sprite, let sprite point to a paired spriteOwner's sprite. */
|
---|
475 | SpritePtr sprite; /* sprite information */
|
---|
476 | Bool spriteOwner; /* True if device owns the sprite */
|
---|
477 | DeviceIntPtr paired; /* The paired device. Keyboard if
|
---|
478 | spriteOwner is TRUE, otherwise the
|
---|
479 | pointer that owns the sprite. */
|
---|
480 | } SpriteInfoRec, *SpriteInfoPtr;
|
---|
481 |
|
---|
482 | /* device types */
|
---|
483 | #define MASTER_POINTER 1
|
---|
484 | #define MASTER_KEYBOARD 2
|
---|
485 | #define SLAVE 3
|
---|
486 |
|
---|
487 | typedef struct _DeviceIntRec {
|
---|
488 | DeviceRec public;
|
---|
489 | DeviceIntPtr next;
|
---|
490 | Bool startup; /* true if needs to be turned on at
|
---|
491 | server intialization time */
|
---|
492 | DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is
|
---|
493 | used to initialize, turn on, or
|
---|
494 | turn off the device */
|
---|
495 | Bool inited; /* TRUE if INIT returns Success */
|
---|
496 | Bool enabled; /* TRUE if ON returns Success */
|
---|
497 | Bool coreEvents; /* TRUE if device also sends core */
|
---|
498 | GrabInfoRec deviceGrab; /* grab on the device */
|
---|
499 | int type; /* MASTER_POINTER, MASTER_KEYBOARD, SLAVE */
|
---|
500 | Atom xinput_type;
|
---|
501 | char *name;
|
---|
502 | int id;
|
---|
503 | KeyClassPtr key;
|
---|
504 | ValuatorClassPtr valuator;
|
---|
505 | ButtonClassPtr button;
|
---|
506 | FocusClassPtr focus;
|
---|
507 | ProximityClassPtr proximity;
|
---|
508 | AbsoluteClassPtr absolute;
|
---|
509 | KbdFeedbackPtr kbdfeed;
|
---|
510 | PtrFeedbackPtr ptrfeed;
|
---|
511 | IntegerFeedbackPtr intfeed;
|
---|
512 | StringFeedbackPtr stringfeed;
|
---|
513 | BellFeedbackPtr bell;
|
---|
514 | LedFeedbackPtr leds;
|
---|
515 | struct _XkbInterest *xkb_interest;
|
---|
516 | char *config_info; /* used by the hotplug layer */
|
---|
517 | PrivateRec *devPrivates;
|
---|
518 | int nPrivates;
|
---|
519 | DeviceUnwrapProc unwrapProc;
|
---|
520 | SpriteInfoPtr spriteInfo;
|
---|
521 | union {
|
---|
522 | DeviceIntPtr master; /* master device */
|
---|
523 | DeviceIntPtr lastSlave; /* last slave device used */
|
---|
524 | } u;
|
---|
525 |
|
---|
526 | /* last valuator values recorded, not posted to client;
|
---|
527 | * for slave devices, valuators is in device coordinates
|
---|
528 | * for master devices, valuators is in screen coordinates
|
---|
529 | * see dix/getevents.c
|
---|
530 | * remainder supports acceleration
|
---|
531 | */
|
---|
532 | struct {
|
---|
533 | int valuators[MAX_VALUATORS];
|
---|
534 | float remainder[MAX_VALUATORS];
|
---|
535 | int numValuators;
|
---|
536 | DeviceIntPtr slave;
|
---|
537 | } last;
|
---|
538 |
|
---|
539 | /* Input device property handling. */
|
---|
540 | struct {
|
---|
541 | XIPropertyPtr properties;
|
---|
542 | XIPropertyHandlerPtr handlers; /* NULL-terminated */
|
---|
543 | } properties;
|
---|
544 | } DeviceIntRec;
|
---|
545 |
|
---|
546 | typedef struct {
|
---|
547 | int numDevices; /* total number of devices */
|
---|
548 | DeviceIntPtr devices; /* all devices turned on */
|
---|
549 | DeviceIntPtr off_devices; /* all devices turned off */
|
---|
550 | DeviceIntPtr keyboard; /* the main one for the server */
|
---|
551 | DeviceIntPtr pointer;
|
---|
552 | DeviceIntPtr all_devices;
|
---|
553 | DeviceIntPtr all_master_devices;
|
---|
554 | } InputInfo;
|
---|
555 |
|
---|
556 | extern _X_EXPORT InputInfo inputInfo;
|
---|
557 |
|
---|
558 | /* for keeping the events for devices grabbed synchronously */
|
---|
559 | typedef struct _QdEvent *QdEventPtr;
|
---|
560 | typedef struct _QdEvent {
|
---|
561 | QdEventPtr next;
|
---|
562 | DeviceIntPtr device;
|
---|
563 | ScreenPtr pScreen; /* what screen the pointer was on */
|
---|
564 | unsigned long months; /* milliseconds is in the event */
|
---|
565 | InternalEvent *event;
|
---|
566 | } QdEventRec;
|
---|
567 |
|
---|
568 | /**
|
---|
569 | * syncEvents is the global structure for queued events.
|
---|
570 | *
|
---|
571 | * Devices can be frozen through GrabModeSync pointer grabs. If this is the
|
---|
572 | * case, events from these devices are added to "pending" instead of being
|
---|
573 | * processed normally. When the device is unfrozen, events in "pending" are
|
---|
574 | * replayed and processed as if they would come from the device directly.
|
---|
575 | */
|
---|
576 | typedef struct _EventSyncInfo {
|
---|
577 | QdEventPtr pending, /**< list of queued events */
|
---|
578 | *pendtail; /**< last event in list */
|
---|
579 | /** The device to replay events for. Only set in AllowEvents(), in which
|
---|
580 | * case it is set to the device specified in the request. */
|
---|
581 | DeviceIntPtr replayDev; /* kludgy rock to put flag for */
|
---|
582 |
|
---|
583 | /**
|
---|
584 | * The window the events are supposed to be replayed on.
|
---|
585 | * This window may be set to the grab's window (but only when
|
---|
586 | * Replay{Pointer|Keyboard} is given in the XAllowEvents()
|
---|
587 | * request. */
|
---|
588 | WindowPtr replayWin; /* ComputeFreezes */
|
---|
589 | /**
|
---|
590 | * Flag to indicate whether we're in the process of
|
---|
591 | * replaying events. Only set in ComputeFreezes(). */
|
---|
592 | Bool playingEvents;
|
---|
593 | TimeStamp time;
|
---|
594 | } EventSyncInfoRec, *EventSyncInfoPtr;
|
---|
595 |
|
---|
596 | extern EventSyncInfoRec syncEvents;
|
---|
597 |
|
---|
598 | #endif /* INPUTSTRUCT_H */
|
---|