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