VirtualBox

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

Last change on this file since 68495 was 36308, checked in by vboxsync, 14 years ago

fix OSE

  • Property svn:eol-style set to native
File size: 21.0 KB
Line 
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)))
63extern _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 */
93typedef 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 */
106typedef 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 */
127typedef 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
155typedef struct _DetailRec { /* Grab details may be bit masks */
156 unsigned int exact;
157 Mask *pMask;
158} DetailRec;
159
160typedef enum {
161 GRABTYPE_CORE,
162 GRABTYPE_XI,
163 GRABTYPE_XI2
164} GrabType;
165
166union _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 */
185typedef 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 */
209typedef 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
247typedef 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
255typedef 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
265typedef struct _ValuatorAccelerationRec {
266 int number;
267 PointerAccelSchemeProc AccelSchemeProc;
268 void *accelData; /* at disposal of AccelScheme */
269 DeviceCallbackProc AccelCleanupProc;
270} ValuatorAccelerationRec, *ValuatorAccelerationPtr;
271
272typedef struct _ValuatorClassRec {
273 int sourceid;
274 int numMotionEvents;
275 int first_motion;
276 int last_motion;
277 void *motion; /* motion history buffer. Different layout
278 for MDs and SDs!*/
279 WindowPtr motionHintWindow;
280
281 AxisInfoPtr axes;
282 unsigned short numAxes;
283 double *axisVal; /* always absolute, but device-coord system */
284 ValuatorAccelerationRec accelScheme;
285} ValuatorClassRec, *ValuatorClassPtr;
286
287typedef struct _ButtonClassRec {
288 int sourceid;
289 CARD8 numButtons;
290 CARD8 buttonsDown; /* number of buttons currently down
291 This counts logical buttons, not
292 physical ones, i.e if some buttons
293 are mapped to 0, they're not counted
294 here */
295 unsigned short state;
296 Mask motionMask;
297 CARD8 down[DOWN_LENGTH];
298 CARD8 postdown[DOWN_LENGTH];
299 CARD8 map[MAP_LENGTH];
300 union _XkbAction *xkb_acts;
301 Atom labels[MAX_BUTTONS];
302} ButtonClassRec, *ButtonClassPtr;
303
304typedef struct _FocusClassRec {
305 int sourceid;
306 WindowPtr win; /* May be set to a int constant (e.g. PointerRootWin)! */
307 int revert;
308 TimeStamp time;
309 WindowPtr *trace;
310 int traceSize;
311 int traceGood;
312} FocusClassRec, *FocusClassPtr;
313
314typedef struct _ProximityClassRec {
315 int sourceid;
316 char in_proximity;
317} ProximityClassRec, *ProximityClassPtr;
318
319typedef struct _AbsoluteClassRec {
320 int sourceid;
321 /* Calibration. */
322 int min_x;
323 int max_x;
324 int min_y;
325 int max_y;
326 int flip_x;
327 int flip_y;
328 int rotation;
329 int button_threshold;
330
331 /* Area. */
332 int offset_x;
333 int offset_y;
334 int width;
335 int height;
336 int screen;
337 XID following;
338} AbsoluteClassRec, *AbsoluteClassPtr;
339
340typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr;
341typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr;
342typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr;
343typedef struct _StringFeedbackClassRec *StringFeedbackPtr;
344typedef struct _BellFeedbackClassRec *BellFeedbackPtr;
345typedef struct _LedFeedbackClassRec *LedFeedbackPtr;
346
347typedef struct _KbdFeedbackClassRec {
348 BellProcPtr BellProc;
349 KbdCtrlProcPtr CtrlProc;
350 KeybdCtrl ctrl;
351 KbdFeedbackPtr next;
352 struct _XkbSrvLedInfo *xkb_sli;
353} KbdFeedbackClassRec;
354
355typedef struct _PtrFeedbackClassRec {
356 PtrCtrlProcPtr CtrlProc;
357 PtrCtrl ctrl;
358 PtrFeedbackPtr next;
359} PtrFeedbackClassRec;
360
361typedef struct _IntegerFeedbackClassRec {
362 IntegerCtrlProcPtr CtrlProc;
363 IntegerCtrl ctrl;
364 IntegerFeedbackPtr next;
365} IntegerFeedbackClassRec;
366
367typedef struct _StringFeedbackClassRec {
368 StringCtrlProcPtr CtrlProc;
369 StringCtrl ctrl;
370 StringFeedbackPtr next;
371} StringFeedbackClassRec;
372
373typedef struct _BellFeedbackClassRec {
374 BellProcPtr BellProc;
375 BellCtrlProcPtr CtrlProc;
376 BellCtrl ctrl;
377 BellFeedbackPtr next;
378} BellFeedbackClassRec;
379
380typedef struct _LedFeedbackClassRec {
381 LedCtrlProcPtr CtrlProc;
382 LedCtrl ctrl;
383 LedFeedbackPtr next;
384 struct _XkbSrvLedInfo *xkb_sli;
385} LedFeedbackClassRec;
386
387
388typedef struct _ClassesRec {
389 KeyClassPtr key;
390 ValuatorClassPtr valuator;
391 ButtonClassPtr button;
392 FocusClassPtr focus;
393 ProximityClassPtr proximity;
394 AbsoluteClassPtr absolute;
395 KbdFeedbackPtr kbdfeed;
396 PtrFeedbackPtr ptrfeed;
397 IntegerFeedbackPtr intfeed;
398 StringFeedbackPtr stringfeed;
399 BellFeedbackPtr bell;
400 LedFeedbackPtr leds;
401} ClassesRec;
402
403
404/* Device properties */
405typedef struct _XIPropertyValue
406{
407 Atom type; /* ignored by server */
408 short format; /* format of data for swapping - 8,16,32 */
409 long size; /* size of data in (format/8) bytes */
410 pointer data; /* private to client */
411} XIPropertyValueRec;
412
413typedef struct _XIProperty
414{
415 struct _XIProperty *next;
416 Atom propertyName;
417 BOOL deletable; /* clients can delete this prop? */
418 XIPropertyValueRec value;
419} XIPropertyRec;
420
421typedef XIPropertyRec *XIPropertyPtr;
422typedef XIPropertyValueRec *XIPropertyValuePtr;
423
424
425typedef struct _XIPropertyHandler
426{
427 struct _XIPropertyHandler* next;
428 long id;
429 int (*SetProperty) (DeviceIntPtr dev,
430 Atom property,
431 XIPropertyValuePtr prop,
432 BOOL checkonly);
433 int (*GetProperty) (DeviceIntPtr dev,
434 Atom property);
435 int (*DeleteProperty) (DeviceIntPtr dev,
436 Atom property);
437} XIPropertyHandler, *XIPropertyHandlerPtr;
438
439/* states for devices */
440
441#define NOT_GRABBED 0
442#define THAWED 1
443#define THAWED_BOTH 2 /* not a real state */
444#define FREEZE_NEXT_EVENT 3
445#define FREEZE_BOTH_NEXT_EVENT 4
446#define FROZEN 5 /* any state >= has device frozen */
447#define FROZEN_NO_EVENT 5
448#define FROZEN_WITH_EVENT 6
449#define THAW_OTHERS 7
450
451
452typedef struct _GrabInfoRec {
453 TimeStamp grabTime;
454 Bool fromPassiveGrab; /* true if from passive grab */
455 Bool implicitGrab; /* implicit from ButtonPress */
456 GrabRec activeGrab;
457 GrabPtr grab;
458 CARD8 activatingKey;
459 void (*ActivateGrab) (
460 DeviceIntPtr /*device*/,
461 GrabPtr /*grab*/,
462 TimeStamp /*time*/,
463 Bool /*autoGrab*/);
464 void (*DeactivateGrab)(
465 DeviceIntPtr /*device*/);
466 struct {
467 Bool frozen;
468 int state;
469 GrabPtr other; /* if other grab has this frozen */
470 DeviceEvent *event; /* saved to be replayed */
471 } sync;
472} GrabInfoRec, *GrabInfoPtr;
473
474typedef struct _SpriteInfoRec {
475 /* sprite must always point to a valid sprite. For devices sharing the
476 * sprite, let sprite point to a paired spriteOwner's sprite. */
477 SpritePtr sprite; /* sprite information */
478 Bool spriteOwner; /* True if device owns the sprite */
479 DeviceIntPtr paired; /* The paired device. Keyboard if
480 spriteOwner is TRUE, otherwise the
481 pointer that owns the sprite. */
482
483 /* keep states for animated cursor */
484 struct {
485 CursorPtr pCursor;
486 ScreenPtr pScreen;
487 int elt;
488 CARD32 time;
489 } anim;
490} SpriteInfoRec, *SpriteInfoPtr;
491
492/* device types */
493#define MASTER_POINTER 1
494#define MASTER_KEYBOARD 2
495#define SLAVE 3
496
497typedef struct _DeviceIntRec {
498 DeviceRec public;
499 DeviceIntPtr next;
500 Bool startup; /* true if needs to be turned on at
501 server intialization time */
502 DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is
503 used to initialize, turn on, or
504 turn off the device */
505 Bool inited; /* TRUE if INIT returns Success */
506 Bool enabled; /* TRUE if ON returns Success */
507 Bool coreEvents; /* TRUE if device also sends core */
508 GrabInfoRec deviceGrab; /* grab on the device */
509 int type; /* MASTER_POINTER, MASTER_KEYBOARD, SLAVE */
510 Atom xinput_type;
511 char *name;
512 int id;
513 KeyClassPtr key;
514 ValuatorClassPtr valuator;
515 ButtonClassPtr button;
516 FocusClassPtr focus;
517 ProximityClassPtr proximity;
518 AbsoluteClassPtr absolute;
519 KbdFeedbackPtr kbdfeed;
520 PtrFeedbackPtr ptrfeed;
521 IntegerFeedbackPtr intfeed;
522 StringFeedbackPtr stringfeed;
523 BellFeedbackPtr bell;
524 LedFeedbackPtr leds;
525 struct _XkbInterest *xkb_interest;
526 char *config_info; /* used by the hotplug layer */
527 ClassesPtr unused_classes; /* for master devices */
528 int saved_master_id; /* for slaves while grabbed */
529 PrivateRec *devPrivates;
530 DeviceUnwrapProc unwrapProc;
531 SpriteInfoPtr spriteInfo;
532 union {
533 DeviceIntPtr master; /* master device */
534 DeviceIntPtr lastSlave; /* last slave device used */
535 } u;
536
537 /* last valuator values recorded, not posted to client;
538 * for slave devices, valuators is in device coordinates
539 * for master devices, valuators is in screen coordinates
540 * see dix/getevents.c
541 * remainder supports acceleration
542 */
543 struct {
544 int valuators[MAX_VALUATORS];
545 float remainder[MAX_VALUATORS];
546 int numValuators;
547 DeviceIntPtr slave;
548 } last;
549
550 /* Input device property handling. */
551 struct {
552 XIPropertyPtr properties;
553 XIPropertyHandlerPtr handlers; /* NULL-terminated */
554 } properties;
555
556 /* coordinate transformation matrix for absolute input devices */
557 struct pixman_f_transform transform;
558
559 /* XTest related master device id */
560 int xtest_master_id;
561} DeviceIntRec;
562
563typedef struct {
564 int numDevices; /* total number of devices */
565 DeviceIntPtr devices; /* all devices turned on */
566 DeviceIntPtr off_devices; /* all devices turned off */
567 DeviceIntPtr keyboard; /* the main one for the server */
568 DeviceIntPtr pointer;
569 DeviceIntPtr all_devices;
570 DeviceIntPtr all_master_devices;
571} InputInfo;
572
573extern _X_EXPORT InputInfo inputInfo;
574
575/* for keeping the events for devices grabbed synchronously */
576typedef struct _QdEvent *QdEventPtr;
577typedef struct _QdEvent {
578 QdEventPtr next;
579 DeviceIntPtr device;
580 ScreenPtr pScreen; /* what screen the pointer was on */
581 unsigned long months; /* milliseconds is in the event */
582 InternalEvent *event;
583} QdEventRec;
584
585/**
586 * syncEvents is the global structure for queued events.
587 *
588 * Devices can be frozen through GrabModeSync pointer grabs. If this is the
589 * case, events from these devices are added to "pending" instead of being
590 * processed normally. When the device is unfrozen, events in "pending" are
591 * replayed and processed as if they would come from the device directly.
592 */
593typedef struct _EventSyncInfo {
594 QdEventPtr pending, /**< list of queued events */
595 *pendtail; /**< last event in list */
596 /** The device to replay events for. Only set in AllowEvents(), in which
597 * case it is set to the device specified in the request. */
598 DeviceIntPtr replayDev; /* kludgy rock to put flag for */
599
600 /**
601 * The window the events are supposed to be replayed on.
602 * This window may be set to the grab's window (but only when
603 * Replay{Pointer|Keyboard} is given in the XAllowEvents()
604 * request. */
605 WindowPtr replayWin; /* ComputeFreezes */
606 /**
607 * Flag to indicate whether we're in the process of
608 * replaying events. Only set in ComputeFreezes(). */
609 Bool playingEvents;
610 TimeStamp time;
611} EventSyncInfoRec, *EventSyncInfoPtr;
612
613extern EventSyncInfoRec syncEvents;
614
615#endif /* INPUTSTRUCT_H */
Note: See TracBrowser for help on using the repository browser.

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