c3297db64bf4223bbb359b014a7b9f1a5f95e82d
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
9 documentation.
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.
28 All Rights Reserved
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
44 SOFTWARE.
46 ********************************************************/
49 #ifndef INPUTSTRUCT_H
50 #define INPUTSTRUCT_H
52 #include <X11/extensions/XI2proto.h>
54 #include <pixman.h>
55 #include "input.h"
56 #include "window.h"
57 #include "dixstruct.h"
58 #include "cursorstr.h"
59 #include "geext.h"
60 #include "privates.h"
62 #define BitIsOn(ptr, bit) (!!(((const BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))))
63 #define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7)))
64 #define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7)))
65 extern _X_EXPORT int CountBits(const uint8_t *mask, int len);
67 #define SameClient(obj,client) \
68 (CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
70 #define EMASKSIZE MAXDEVICES + 2
72 /* This is the last XI2 event supported by the server. If you add
73 * events to the protocol, the server will not support these events until
74 * this number here is bumped.
75 */
76 #define XI2LASTEVENT XI_RawTouchEnd
77 #define XI2MASKSIZE ((XI2LASTEVENT >> 3) + 1) /* no of bytes for masks */
79 /**
80 * Scroll types for ::SetScrollValuator and the scroll type in the
81 * ::ScrollInfoPtr.
82 */
83 enum ScrollType {
84 SCROLL_TYPE_NONE = 0, /**< Not a scrolling valuator */
85 SCROLL_TYPE_VERTICAL = 8,
86 SCROLL_TYPE_HORIZONTAL = 9,
87 };
89 /**
90 * This struct stores the core event mask for each client except the client
91 * that created the window.
92 *
93 * Each window that has events selected from other clients has at least one of
94 * these masks. If multiple clients selected for events on the same window,
95 * these masks are in a linked list.
96 *
97 * The event mask for the client that created the window is stored in
98 * win->eventMask instead.
99 *
100 * The resource id is simply a fake client ID to associate this mask with a
101 * client.
102 *
103 * Kludge: OtherClients and InputClients must be compatible, see code.
104 */
105 typedef struct _OtherClients {
106 OtherClientsPtr next; /**< Pointer to the next mask */
107 XID resource; /**< id for putting into resource manager */
108 Mask mask; /**< Core event mask */
109 } OtherClients;
111 /**
112 * This struct stores the XI event mask for each client.
113 *
114 * Each window that has events selected has at least one of these masks. If
115 * multiple client selected for events on the same window, these masks are in
116 * a linked list.
117 */
118 typedef struct _InputClients {
119 InputClientsPtr next; /**< Pointer to the next mask */
120 XID resource; /**< id for putting into resource manager */
121 Mask mask[EMASKSIZE]; /**< Actual XI event mask, deviceid is index */
122 /** XI2 event masks. One per device, each bit is a mask of (1 << type) */
123 struct _XI2Mask *xi2mask;
124 } InputClients;
126 /**
127 * Combined XI event masks from all devices.
128 *
129 * This is the XI equivalent of the deliverableEvents, eventMask and
130 * dontPropagate mask of the WindowRec (or WindowOptRec).
131 *
132 * A window that has an XI client selecting for events has exactly one
133 * OtherInputMasks struct and exactly one InputClients struct hanging off
134 * inputClients. Each further client appends to the inputClients list.
135 * Each Mask field is per-device, with the device id as the index.
136 * Exception: for non-device events (Presence events), the MAXDEVICES
137 * deviceid is used.
138 */
139 typedef struct _OtherInputMasks {
140 /**
141 * Bitwise OR of all masks by all clients and the window's parent's masks.
142 */
143 Mask deliverableEvents[EMASKSIZE];
144 /**
145 * Bitwise OR of all masks by all clients on this window.
146 */
147 Mask inputEvents[EMASKSIZE];
148 /** The do-not-propagate masks for each device. */
149 Mask dontPropagateMask[EMASKSIZE];
150 /** The clients that selected for events */
151 InputClientsPtr inputClients;
152 /* XI2 event masks. One per device, each bit is a mask of (1 << type) */
153 struct _XI2Mask *xi2mask;
154 } OtherInputMasks;
156 /*
157 * The following structure gets used for both active and passive grabs. For
158 * active grabs some of the fields (e.g. modifiers) are not used. However,
159 * that is not much waste since there aren't many active grabs (one per
160 * keyboard/pointer device) going at once in the server.
161 */
163 #define MasksPerDetailMask 8 /* 256 keycodes and 256 possible
164 modifier combinations, but only
165 3 buttons. */
167 typedef struct _DetailRec { /* Grab details may be bit masks */
168 unsigned int exact;
169 Mask *pMask;
170 } DetailRec;
172 union _GrabMask {
173 Mask core;
174 Mask xi;
175 struct _XI2Mask *xi2mask;
176 };
178 /**
179 * Central struct for device grabs.
180 * The same struct is used for both core grabs and device grabs, with
181 * different fields being set.
182 * If the grab is a core grab (GrabPointer/GrabKeyboard), then the eventMask
183 * is a combination of standard event masks (i.e. PointerMotionMask |
184 * ButtonPressMask).
185 * If the grab is a device grab (GrabDevice), then the eventMask is a
186 * combination of event masks for a given XI event type (see SetEventInfo).
187 *
188 * If the grab is a result of a ButtonPress, then eventMask is the core mask
189 * and deviceMask is set to the XI event mask for the grab.
190 */
191 typedef struct _GrabRec {
192 GrabPtr next; /* for chain of passive grabs */
193 XID resource;
194 DeviceIntPtr device;
195 WindowPtr window;
196 unsigned ownerEvents:1;
197 unsigned keyboardMode:1;
198 unsigned pointerMode:1;
199 enum InputLevel grabtype;
200 CARD8 type; /* event type */
201 DetailRec modifiersDetail;
202 DeviceIntPtr modifierDevice;
203 DetailRec detail; /* key or button */
204 WindowPtr confineTo; /* always NULL for keyboards */
205 CursorPtr cursor; /* always NULL for keyboards */
206 Mask eventMask;
207 Mask deviceMask;
208 /* XI2 event masks. One per device, each bit is a mask of (1 << type) */
209 struct _XI2Mask *xi2mask;
210 } GrabRec;
212 /**
213 * Sprite information for a device.
214 */
215 typedef struct _SpriteRec {
216 CursorPtr current;
217 BoxRec hotLimits; /* logical constraints of hot spot */
218 Bool confined; /* confined to screen */
219 RegionPtr hotShape; /* additional logical shape constraint */
220 BoxRec physLimits; /* physical constraints of hot spot */
221 WindowPtr win; /* window of logical position */
222 HotSpot hot; /* logical pointer position */
223 HotSpot hotPhys; /* physical pointer position */
224 #ifdef PANORAMIX
225 ScreenPtr screen; /* all others are in Screen 0 coordinates */
226 RegionRec Reg1; /* Region 1 for confining motion */
227 RegionRec Reg2; /* Region 2 for confining virtual motion */
228 WindowPtr windows[MAXSCREENS];
229 WindowPtr confineWin; /* confine window */
230 #endif
231 /* The window trace information is used at dix/events.c to avoid having
232 * to compute all the windows between the root and the current pointer
233 * window each time a button or key goes down. The grabs on each of those
234 * windows must be checked.
235 * spriteTraces should only be used at dix/events.c! */
236 WindowPtr *spriteTrace;
237 int spriteTraceSize;
238 int spriteTraceGood;
240 /* Due to delays between event generation and event processing, it is
241 * possible that the pointer has crossed screen boundaries between the
242 * time in which it begins generating events and the time when
243 * those events are processed.
244 *
245 * pEnqueueScreen: screen the pointer was on when the event was generated
246 * pDequeueScreen: screen the pointer was on when the event is processed
247 */
248 ScreenPtr pEnqueueScreen;
249 ScreenPtr pDequeueScreen;
251 } SpriteRec;
253 typedef struct _KeyClassRec {
254 int sourceid;
255 CARD8 down[DOWN_LENGTH];
256 CARD8 postdown[DOWN_LENGTH];
257 int modifierKeyCount[8];
258 struct _XkbSrvInfo *xkbInfo;
259 } KeyClassRec, *KeyClassPtr;
261 typedef struct _ScrollInfo {
262 enum ScrollType type;
263 double increment;
264 int flags;
265 } ScrollInfo, *ScrollInfoPtr;
267 typedef struct _AxisInfo {
268 int resolution;
269 int min_resolution;
270 int max_resolution;
271 int min_value;
272 int max_value;
273 Atom label;
274 CARD8 mode;
275 ScrollInfo scroll;
276 } AxisInfo, *AxisInfoPtr;
278 typedef struct _ValuatorAccelerationRec {
279 int number;
280 PointerAccelSchemeProc AccelSchemeProc;
281 void *accelData; /* at disposal of AccelScheme */
282 PointerAccelSchemeInitProc AccelInitProc;
283 DeviceCallbackProc AccelCleanupProc;
284 } ValuatorAccelerationRec, *ValuatorAccelerationPtr;
286 typedef struct _ValuatorClassRec {
287 int sourceid;
288 int numMotionEvents;
289 int first_motion;
290 int last_motion;
291 void *motion; /* motion history buffer. Different layout
292 for MDs and SDs!*/
293 WindowPtr motionHintWindow;
295 AxisInfoPtr axes;
296 unsigned short numAxes;
297 double *axisVal; /* always absolute, but device-coord system */
298 ValuatorAccelerationRec accelScheme;
299 int h_scroll_axis; /* horiz smooth-scrolling axis */
300 int v_scroll_axis; /* vert smooth-scrolling axis */
301 } ValuatorClassRec;
303 typedef struct _TouchPointInfo {
304 uint32_t client_id; /* touch ID as seen in client events */
305 int sourceid; /* Source device's ID for this touchpoint */
306 Bool active; /* whether or not the touch is active */
307 Bool pending_finish; /* true if the touch is physically inactive
308 * but still owned by a grab */
309 SpriteRec sprite; /* window trace for delivery */
310 ValuatorMask *valuators; /* last recorded axis values */
311 struct _TouchListener {
312 XID listener; /* grabs/event selection IDs receiving
313 * events for this touch */
314 enum TouchListenerType type;
315 enum TouchListenerState state;
316 enum InputLevel level; /* matters only for emulating touches */
317 } *listeners;
318 int num_listeners;
319 int num_grabs; /* number of open grabs on this touch
320 * which have not accepted or rejected */
321 Bool emulate_pointer;
322 DeviceEvent *history; /* History of events on this touchpoint */
323 size_t history_elements; /* Number of current elements in history */
324 size_t history_size; /* Size of history in elements */
325 } TouchPointInfoRec;
327 typedef struct _TouchListener TouchListener;
329 typedef struct _DDXTouchPointInfo {
330 uint32_t client_id; /* touch ID as seen in client events */
331 Bool active; /* whether or not the touch is active */
332 uint32_t ddx_id; /* touch ID given by the DDX */
333 Bool emulate_pointer;
335 ValuatorMask* valuators; /* last recorded axis values */
336 } DDXTouchPointInfoRec;
338 typedef struct _TouchClassRec {
339 int sourceid;
340 TouchPointInfoPtr touches;
341 unsigned short num_touches; /* number of allocated touches */
342 unsigned short max_touches; /* maximum number of touches, may be 0 */
343 CARD8 mode; /* ::XIDirectTouch, XIDependentTouch */
344 /* for pointer-emulation */
345 CARD8 buttonsDown; /* number of buttons down */
346 unsigned short state; /* logical button state */
347 Mask motionMask;
348 } TouchClassRec;
350 typedef struct _ButtonClassRec {
351 int sourceid;
352 CARD8 numButtons;
353 CARD8 buttonsDown; /* number of buttons currently down
354 This counts logical buttons, not
355 physical ones, i.e if some buttons
356 are mapped to 0, they're not counted
357 here */
358 unsigned short state;
359 Mask motionMask;
360 CARD8 down[DOWN_LENGTH];
361 CARD8 postdown[DOWN_LENGTH];
362 CARD8 map[MAP_LENGTH];
363 union _XkbAction *xkb_acts;
364 Atom labels[MAX_BUTTONS];
365 } ButtonClassRec, *ButtonClassPtr;
367 typedef struct _FocusClassRec {
368 int sourceid;
369 WindowPtr win; /* May be set to a int constant (e.g. PointerRootWin)! */
370 int revert;
371 TimeStamp time;
372 WindowPtr *trace;
373 int traceSize;
374 int traceGood;
375 } FocusClassRec, *FocusClassPtr;
377 typedef struct _ProximityClassRec {
378 int sourceid;
379 char in_proximity;
380 } ProximityClassRec, *ProximityClassPtr;
382 typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr;
383 typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr;
384 typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr;
385 typedef struct _StringFeedbackClassRec *StringFeedbackPtr;
386 typedef struct _BellFeedbackClassRec *BellFeedbackPtr;
387 typedef struct _LedFeedbackClassRec *LedFeedbackPtr;
389 typedef struct _KbdFeedbackClassRec {
390 BellProcPtr BellProc;
391 KbdCtrlProcPtr CtrlProc;
392 KeybdCtrl ctrl;
393 KbdFeedbackPtr next;
394 struct _XkbSrvLedInfo *xkb_sli;
395 } KbdFeedbackClassRec;
397 typedef struct _PtrFeedbackClassRec {
398 PtrCtrlProcPtr CtrlProc;
399 PtrCtrl ctrl;
400 PtrFeedbackPtr next;
401 } PtrFeedbackClassRec;
403 typedef struct _IntegerFeedbackClassRec {
404 IntegerCtrlProcPtr CtrlProc;
405 IntegerCtrl ctrl;
406 IntegerFeedbackPtr next;
407 } IntegerFeedbackClassRec;
409 typedef struct _StringFeedbackClassRec {
410 StringCtrlProcPtr CtrlProc;
411 StringCtrl ctrl;
412 StringFeedbackPtr next;
413 } StringFeedbackClassRec;
415 typedef struct _BellFeedbackClassRec {
416 BellProcPtr BellProc;
417 BellCtrlProcPtr CtrlProc;
418 BellCtrl ctrl;
419 BellFeedbackPtr next;
420 } BellFeedbackClassRec;
422 typedef struct _LedFeedbackClassRec {
423 LedCtrlProcPtr CtrlProc;
424 LedCtrl ctrl;
425 LedFeedbackPtr next;
426 struct _XkbSrvLedInfo *xkb_sli;
427 } LedFeedbackClassRec;
430 typedef struct _ClassesRec {
431 KeyClassPtr key;
432 ValuatorClassPtr valuator;
433 TouchClassPtr touch;
434 ButtonClassPtr button;
435 FocusClassPtr focus;
436 ProximityClassPtr proximity;
437 KbdFeedbackPtr kbdfeed;
438 PtrFeedbackPtr ptrfeed;
439 IntegerFeedbackPtr intfeed;
440 StringFeedbackPtr stringfeed;
441 BellFeedbackPtr bell;
442 LedFeedbackPtr leds;
443 } ClassesRec;
446 /* Device properties */
447 typedef struct _XIPropertyValue
448 {
449 Atom type; /* ignored by server */
450 short format; /* format of data for swapping - 8,16,32 */
451 long size; /* size of data in (format/8) bytes */
452 pointer data; /* private to client */
453 } XIPropertyValueRec;
455 typedef struct _XIProperty
456 {
457 struct _XIProperty *next;
458 Atom propertyName;
459 BOOL deletable; /* clients can delete this prop? */
460 XIPropertyValueRec value;
461 } XIPropertyRec;
463 typedef XIPropertyRec *XIPropertyPtr;
464 typedef XIPropertyValueRec *XIPropertyValuePtr;
467 typedef struct _XIPropertyHandler
468 {
469 struct _XIPropertyHandler* next;
470 long id;
471 int (*SetProperty) (DeviceIntPtr dev,
472 Atom property,
473 XIPropertyValuePtr prop,
474 BOOL checkonly);
475 int (*GetProperty) (DeviceIntPtr dev,
476 Atom property);
477 int (*DeleteProperty) (DeviceIntPtr dev,
478 Atom property);
479 } XIPropertyHandler, *XIPropertyHandlerPtr;
481 /* states for devices */
483 #define NOT_GRABBED 0
484 #define THAWED 1
485 #define THAWED_BOTH 2 /* not a real state */
486 #define FREEZE_NEXT_EVENT 3
487 #define FREEZE_BOTH_NEXT_EVENT 4
488 #define FROZEN 5 /* any state >= has device frozen */
489 #define FROZEN_NO_EVENT 5
490 #define FROZEN_WITH_EVENT 6
491 #define THAW_OTHERS 7
494 typedef struct _GrabInfoRec {
495 TimeStamp grabTime;
496 Bool fromPassiveGrab; /* true if from passive grab */
497 Bool implicitGrab; /* implicit from ButtonPress */
498 GrabPtr activeGrab;
499 GrabPtr grab;
500 CARD8 activatingKey;
501 void (*ActivateGrab) (
502 DeviceIntPtr /*device*/,
503 GrabPtr /*grab*/,
504 TimeStamp /*time*/,
505 Bool /*autoGrab*/);
506 void (*DeactivateGrab)(
507 DeviceIntPtr /*device*/);
508 struct {
509 Bool frozen;
510 int state;
511 GrabPtr other; /* if other grab has this frozen */
512 DeviceEvent *event; /* saved to be replayed */
513 } sync;
514 } GrabInfoRec, *GrabInfoPtr;
516 typedef struct _SpriteInfoRec {
517 /* sprite must always point to a valid sprite. For devices sharing the
518 * sprite, let sprite point to a paired spriteOwner's sprite. */
519 SpritePtr sprite; /* sprite information */
520 Bool spriteOwner; /* True if device owns the sprite */
521 DeviceIntPtr paired; /* The paired device. Keyboard if
522 spriteOwner is TRUE, otherwise the
523 pointer that owns the sprite. */
525 /* keep states for animated cursor */
526 struct {
527 CursorPtr pCursor;
528 ScreenPtr pScreen;
529 int elt;
530 CARD32 time;
531 } anim;
532 } SpriteInfoRec, *SpriteInfoPtr;
534 /* device types */
535 #define MASTER_POINTER 1
536 #define MASTER_KEYBOARD 2
537 #define SLAVE 3
538 /* special types for GetMaster */
539 #define MASTER_ATTACHED 4 /* Master for this device */
540 #define KEYBOARD_OR_FLOAT 5 /* Keyboard master for this device or this device if floating */
541 #define POINTER_OR_FLOAT 6 /* Pointer master for this device or this device if floating */
543 typedef struct _DeviceIntRec {
544 DeviceRec public;
545 DeviceIntPtr next;
546 Bool startup; /* true if needs to be turned on at
547 server initialization time */
548 DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is
549 used to initialize, turn on, or
550 turn off the device */
551 Bool inited; /* TRUE if INIT returns Success */
552 Bool enabled; /* TRUE if ON returns Success */
553 Bool coreEvents; /* TRUE if device also sends core */
554 GrabInfoRec deviceGrab; /* grab on the device */
555 int type; /* MASTER_POINTER, MASTER_KEYBOARD, SLAVE */
556 Atom xinput_type;
557 char *name;
558 int id;
559 KeyClassPtr key;
560 ValuatorClassPtr valuator;
561 TouchClassPtr touch;
562 ButtonClassPtr button;
563 FocusClassPtr focus;
564 ProximityClassPtr proximity;
565 KbdFeedbackPtr kbdfeed;
566 PtrFeedbackPtr ptrfeed;
567 IntegerFeedbackPtr intfeed;
568 StringFeedbackPtr stringfeed;
569 BellFeedbackPtr bell;
570 LedFeedbackPtr leds;
571 struct _XkbInterest *xkb_interest;
572 char *config_info; /* used by the hotplug layer */
573 ClassesPtr unused_classes; /* for master devices */
574 int saved_master_id; /* for slaves while grabbed */
575 PrivateRec *devPrivates;
576 DeviceUnwrapProc unwrapProc;
577 SpriteInfoPtr spriteInfo;
578 DeviceIntPtr master; /* master device */
579 DeviceIntPtr lastSlave; /* last slave device used */
581 /* last valuator values recorded, not posted to client;
582 * for slave devices, valuators is in device coordinates, mapped to the
583 * desktop
584 * for master devices, valuators is in desktop coordinates.
585 * see dix/getevents.c
586 * remainder supports acceleration
587 */
588 struct {
589 double valuators[MAX_VALUATORS];
590 int numValuators;
591 DeviceIntPtr slave;
592 ValuatorMask *scroll;
593 int num_touches; /* size of the touches array */
594 DDXTouchPointInfoPtr touches;
595 } last;
597 /* Input device property handling. */
598 struct {
599 XIPropertyPtr properties;
600 XIPropertyHandlerPtr handlers; /* NULL-terminated */
601 } properties;
603 /* coordinate transformation matrix for absolute input devices */
604 struct pixman_f_transform transform;
606 /* XTest related master device id */
607 int xtest_master_id;
608 } DeviceIntRec;
610 typedef struct {
611 int numDevices; /* total number of devices */
612 DeviceIntPtr devices; /* all devices turned on */
613 DeviceIntPtr off_devices; /* all devices turned off */
614 DeviceIntPtr keyboard; /* the main one for the server */
615 DeviceIntPtr pointer;
616 DeviceIntPtr all_devices;
617 DeviceIntPtr all_master_devices;
618 } InputInfo;
620 extern _X_EXPORT InputInfo inputInfo;
622 /* for keeping the events for devices grabbed synchronously */
623 typedef struct _QdEvent *QdEventPtr;
624 typedef struct _QdEvent {
625 struct list next;
626 DeviceIntPtr device;
627 ScreenPtr pScreen; /* what screen the pointer was on */
628 unsigned long months; /* milliseconds is in the event */
629 InternalEvent *event;
630 } QdEventRec;
632 /**
633 * syncEvents is the global structure for queued events.
634 *
635 * Devices can be frozen through GrabModeSync pointer grabs. If this is the
636 * case, events from these devices are added to "pending" instead of being
637 * processed normally. When the device is unfrozen, events in "pending" are
638 * replayed and processed as if they would come from the device directly.
639 */
640 typedef struct _EventSyncInfo {
641 struct list pending;
643 /** The device to replay events for. Only set in AllowEvents(), in which
644 * case it is set to the device specified in the request. */
645 DeviceIntPtr replayDev; /* kludgy rock to put flag for */
647 /**
648 * The window the events are supposed to be replayed on.
649 * This window may be set to the grab's window (but only when
650 * Replay{Pointer|Keyboard} is given in the XAllowEvents()
651 * request. */
652 WindowPtr replayWin; /* ComputeFreezes */
653 /**
654 * Flag to indicate whether we're in the process of
655 * replaying events. Only set in ComputeFreezes(). */
656 Bool playingEvents;
657 TimeStamp time;
658 } EventSyncInfoRec, *EventSyncInfoPtr;
660 extern EventSyncInfoRec syncEvents;
662 /**
663 * Given a sprite, returns the window at the bottom of the trace (i.e. the
664 * furthest window from the root).
665 */
666 static inline WindowPtr DeepestSpriteWin(SpritePtr sprite)
667 {
668 assert(sprite->spriteTraceGood > 0);
669 return sprite->spriteTrace[sprite->spriteTraceGood - 1];
670 }
672 struct _XI2Mask {
673 unsigned char **masks; /* event mask in masks[deviceid][event type byte] */
674 size_t nmasks; /* number of masks */
675 size_t mask_size; /* size of each mask in bytes */
676 };
678 #endif /* INPUTSTRUCT_H */