VirtualBox

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

Last change on this file since 64670 was 43272, checked in by vboxsync, 12 years ago

Additions/x11: more original X server headers.

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