VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.9.0/inputstr.h@ 62425

最後變更 在這個檔案從62425是 32163,由 vboxsync 提交於 14 年 前

Additions/x11/x11include: additional headers for building drivers for X.Org Server 1.9

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette