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