1 | /************************************************************
|
---|
2 |
|
---|
3 | Copyright 1987, 1998 The Open Group
|
---|
4 |
|
---|
5 | Permission to use, copy, modify, distribute, and sell this software and its
|
---|
6 | documentation for any purpose is hereby granted without fee, provided that
|
---|
7 | the above copyright notice appear in all copies and that both that
|
---|
8 | copyright notice and this permission notice appear in supporting
|
---|
9 | documentation.
|
---|
10 |
|
---|
11 | The above copyright notice and this permission notice shall be included in
|
---|
12 | all copies or substantial portions of the Software.
|
---|
13 |
|
---|
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
17 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
---|
18 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
20 |
|
---|
21 | Except as contained in this notice, the name of The Open Group shall not be
|
---|
22 | used in advertising or otherwise to promote the sale, use or other dealings
|
---|
23 | in this Software without prior written authorization from The Open Group.
|
---|
24 |
|
---|
25 |
|
---|
26 | Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
---|
27 |
|
---|
28 | All Rights Reserved
|
---|
29 |
|
---|
30 | Permission to use, copy, modify, and distribute this software and its
|
---|
31 | documentation for any purpose and without fee is hereby granted,
|
---|
32 | provided that the above copyright notice appear in all copies and that
|
---|
33 | both that copyright notice and this permission notice appear in
|
---|
34 | supporting documentation, and that the name of Digital not be
|
---|
35 | used in advertising or publicity pertaining to distribution of the
|
---|
36 | software without specific, written prior permission.
|
---|
37 |
|
---|
38 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
---|
39 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
---|
40 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
---|
41 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
---|
42 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
---|
43 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
---|
44 | SOFTWARE.
|
---|
45 |
|
---|
46 | ********************************************************/
|
---|
47 |
|
---|
48 |
|
---|
49 | #ifndef INPUTSTRUCT_H
|
---|
50 | #define INPUTSTRUCT_H
|
---|
51 |
|
---|
52 | #include "input.h"
|
---|
53 | #include "window.h"
|
---|
54 | #include "dixstruct.h"
|
---|
55 |
|
---|
56 | #define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
|
---|
57 |
|
---|
58 | #define SameClient(obj,client) \
|
---|
59 | (CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
|
---|
60 |
|
---|
61 | #define MAX_DEVICES 20
|
---|
62 |
|
---|
63 | #define EMASKSIZE MAX_DEVICES
|
---|
64 |
|
---|
65 | /* Kludge: OtherClients and InputClients must be compatible, see code */
|
---|
66 |
|
---|
67 | typedef struct _OtherClients {
|
---|
68 | OtherClientsPtr next;
|
---|
69 | XID resource; /* id for putting into resource manager */
|
---|
70 | Mask mask;
|
---|
71 | } OtherClients;
|
---|
72 |
|
---|
73 | typedef struct _InputClients {
|
---|
74 | InputClientsPtr next;
|
---|
75 | XID resource; /* id for putting into resource manager */
|
---|
76 | Mask mask[EMASKSIZE];
|
---|
77 | } InputClients;
|
---|
78 |
|
---|
79 | typedef struct _OtherInputMasks {
|
---|
80 | Mask deliverableEvents[EMASKSIZE];
|
---|
81 | Mask inputEvents[EMASKSIZE];
|
---|
82 | Mask dontPropagateMask[EMASKSIZE];
|
---|
83 | InputClientsPtr inputClients;
|
---|
84 | } OtherInputMasks;
|
---|
85 |
|
---|
86 | /*
|
---|
87 | * The following structure gets used for both active and passive grabs. For
|
---|
88 | * active grabs some of the fields (e.g. modifiers) are not used. However,
|
---|
89 | * that is not much waste since there aren't many active grabs (one per
|
---|
90 | * keyboard/pointer device) going at once in the server.
|
---|
91 | */
|
---|
92 |
|
---|
93 | #define MasksPerDetailMask 8 /* 256 keycodes and 256 possible
|
---|
94 | modifier combinations, but only
|
---|
95 | 3 buttons. */
|
---|
96 |
|
---|
97 | typedef struct _DetailRec { /* Grab details may be bit masks */
|
---|
98 | unsigned short exact;
|
---|
99 | Mask *pMask;
|
---|
100 | } DetailRec;
|
---|
101 |
|
---|
102 | typedef struct _GrabRec {
|
---|
103 | GrabPtr next; /* for chain of passive grabs */
|
---|
104 | XID resource;
|
---|
105 | DeviceIntPtr device;
|
---|
106 | WindowPtr window;
|
---|
107 | unsigned ownerEvents:1;
|
---|
108 | unsigned keyboardMode:1;
|
---|
109 | unsigned pointerMode:1;
|
---|
110 | unsigned coreGrab:1; /* grab is on core device */
|
---|
111 | unsigned coreMods:1; /* modifiers are on core keyboard */
|
---|
112 | CARD8 type; /* event type */
|
---|
113 | DetailRec modifiersDetail;
|
---|
114 | DeviceIntPtr modifierDevice;
|
---|
115 | DetailRec detail; /* key or button */
|
---|
116 | WindowPtr confineTo; /* always NULL for keyboards */
|
---|
117 | CursorPtr cursor; /* always NULL for keyboards */
|
---|
118 | Mask eventMask;
|
---|
119 | } GrabRec;
|
---|
120 |
|
---|
121 | typedef struct _KeyClassRec {
|
---|
122 | CARD8 down[DOWN_LENGTH];
|
---|
123 | KeyCode *modifierKeyMap;
|
---|
124 | KeySymsRec curKeySyms;
|
---|
125 | int modifierKeyCount[8];
|
---|
126 | CARD8 modifierMap[MAP_LENGTH];
|
---|
127 | CARD8 maxKeysPerModifier;
|
---|
128 | unsigned short state;
|
---|
129 | unsigned short prev_state;
|
---|
130 | #ifdef XKB
|
---|
131 | struct _XkbSrvInfo *xkbInfo;
|
---|
132 | #endif
|
---|
133 | } KeyClassRec, *KeyClassPtr;
|
---|
134 |
|
---|
135 | typedef struct _AxisInfo {
|
---|
136 | int resolution;
|
---|
137 | int min_resolution;
|
---|
138 | int max_resolution;
|
---|
139 | int min_value;
|
---|
140 | int max_value;
|
---|
141 | } AxisInfo, *AxisInfoPtr;
|
---|
142 |
|
---|
143 | typedef struct _ValuatorClassRec {
|
---|
144 | ValuatorMotionProcPtr GetMotionProc;
|
---|
145 | int numMotionEvents;
|
---|
146 | WindowPtr motionHintWindow;
|
---|
147 | AxisInfoPtr axes;
|
---|
148 | unsigned short numAxes;
|
---|
149 | int *axisVal;
|
---|
150 | CARD8 mode;
|
---|
151 | } ValuatorClassRec, *ValuatorClassPtr;
|
---|
152 |
|
---|
153 | typedef struct _ButtonClassRec {
|
---|
154 | CARD8 numButtons;
|
---|
155 | CARD8 buttonsDown; /* number of buttons currently down */
|
---|
156 | unsigned short state;
|
---|
157 | Mask motionMask;
|
---|
158 | CARD8 down[DOWN_LENGTH];
|
---|
159 | CARD8 map[MAP_LENGTH];
|
---|
160 | #ifdef XKB
|
---|
161 | union _XkbAction * xkb_acts;
|
---|
162 | #endif
|
---|
163 | } ButtonClassRec, *ButtonClassPtr;
|
---|
164 |
|
---|
165 | typedef struct _FocusClassRec {
|
---|
166 | WindowPtr win;
|
---|
167 | int revert;
|
---|
168 | TimeStamp time;
|
---|
169 | WindowPtr *trace;
|
---|
170 | int traceSize;
|
---|
171 | int traceGood;
|
---|
172 | } FocusClassRec, *FocusClassPtr;
|
---|
173 |
|
---|
174 | typedef struct _ProximityClassRec {
|
---|
175 | char pad;
|
---|
176 | } ProximityClassRec, *ProximityClassPtr;
|
---|
177 |
|
---|
178 | typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr;
|
---|
179 | typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr;
|
---|
180 | typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr;
|
---|
181 | typedef struct _StringFeedbackClassRec *StringFeedbackPtr;
|
---|
182 | typedef struct _BellFeedbackClassRec *BellFeedbackPtr;
|
---|
183 | typedef struct _LedFeedbackClassRec *LedFeedbackPtr;
|
---|
184 |
|
---|
185 | typedef struct _KbdFeedbackClassRec {
|
---|
186 | BellProcPtr BellProc;
|
---|
187 | KbdCtrlProcPtr CtrlProc;
|
---|
188 | KeybdCtrl ctrl;
|
---|
189 | KbdFeedbackPtr next;
|
---|
190 | #ifdef XKB
|
---|
191 | struct _XkbSrvLedInfo *xkb_sli;
|
---|
192 | #endif
|
---|
193 | } KbdFeedbackClassRec;
|
---|
194 |
|
---|
195 | typedef struct _PtrFeedbackClassRec {
|
---|
196 | PtrCtrlProcPtr CtrlProc;
|
---|
197 | PtrCtrl ctrl;
|
---|
198 | PtrFeedbackPtr next;
|
---|
199 | } PtrFeedbackClassRec;
|
---|
200 |
|
---|
201 | typedef struct _IntegerFeedbackClassRec {
|
---|
202 | IntegerCtrlProcPtr CtrlProc;
|
---|
203 | IntegerCtrl ctrl;
|
---|
204 | IntegerFeedbackPtr next;
|
---|
205 | } IntegerFeedbackClassRec;
|
---|
206 |
|
---|
207 | typedef struct _StringFeedbackClassRec {
|
---|
208 | StringCtrlProcPtr CtrlProc;
|
---|
209 | StringCtrl ctrl;
|
---|
210 | StringFeedbackPtr next;
|
---|
211 | } StringFeedbackClassRec;
|
---|
212 |
|
---|
213 | typedef struct _BellFeedbackClassRec {
|
---|
214 | BellProcPtr BellProc;
|
---|
215 | BellCtrlProcPtr CtrlProc;
|
---|
216 | BellCtrl ctrl;
|
---|
217 | BellFeedbackPtr next;
|
---|
218 | } BellFeedbackClassRec;
|
---|
219 |
|
---|
220 | typedef struct _LedFeedbackClassRec {
|
---|
221 | LedCtrlProcPtr CtrlProc;
|
---|
222 | LedCtrl ctrl;
|
---|
223 | LedFeedbackPtr next;
|
---|
224 | #ifdef XKB
|
---|
225 | struct _XkbSrvLedInfo *xkb_sli;
|
---|
226 | #endif
|
---|
227 | } LedFeedbackClassRec;
|
---|
228 |
|
---|
229 | /* states for devices */
|
---|
230 |
|
---|
231 | #define NOT_GRABBED 0
|
---|
232 | #define THAWED 1
|
---|
233 | #define THAWED_BOTH 2 /* not a real state */
|
---|
234 | #define FREEZE_NEXT_EVENT 3
|
---|
235 | #define FREEZE_BOTH_NEXT_EVENT 4
|
---|
236 | #define FROZEN 5 /* any state >= has device frozen */
|
---|
237 | #define FROZEN_NO_EVENT 5
|
---|
238 | #define FROZEN_WITH_EVENT 6
|
---|
239 | #define THAW_OTHERS 7
|
---|
240 |
|
---|
241 | typedef struct _DeviceIntRec {
|
---|
242 | DeviceRec public;
|
---|
243 | DeviceIntPtr next;
|
---|
244 | TimeStamp grabTime;
|
---|
245 | Bool startup; /* true if needs to be turned on at
|
---|
246 | server intialization time */
|
---|
247 | DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is
|
---|
248 | used to initialize, turn on, or
|
---|
249 | turn off the device */
|
---|
250 | Bool inited; /* TRUE if INIT returns Success */
|
---|
251 | GrabPtr grab; /* the grabber - used by DIX */
|
---|
252 | struct {
|
---|
253 | Bool frozen;
|
---|
254 | int state;
|
---|
255 | GrabPtr other; /* if other grab has this frozen */
|
---|
256 | xEvent *event; /* saved to be replayed */
|
---|
257 | int evcount;
|
---|
258 | } sync;
|
---|
259 | Atom type;
|
---|
260 | char *name;
|
---|
261 | CARD8 id;
|
---|
262 | CARD8 activatingKey;
|
---|
263 | Bool fromPassiveGrab;
|
---|
264 | GrabRec activeGrab;
|
---|
265 | void (*ActivateGrab) (
|
---|
266 | DeviceIntPtr /*device*/,
|
---|
267 | GrabPtr /*grab*/,
|
---|
268 | TimeStamp /*time*/,
|
---|
269 | Bool /*autoGrab*/);
|
---|
270 | void (*DeactivateGrab)(
|
---|
271 | DeviceIntPtr /*device*/);
|
---|
272 | KeyClassPtr key;
|
---|
273 | ValuatorClassPtr valuator;
|
---|
274 | ButtonClassPtr button;
|
---|
275 | FocusClassPtr focus;
|
---|
276 | ProximityClassPtr proximity;
|
---|
277 | KbdFeedbackPtr kbdfeed;
|
---|
278 | PtrFeedbackPtr ptrfeed;
|
---|
279 | IntegerFeedbackPtr intfeed;
|
---|
280 | StringFeedbackPtr stringfeed;
|
---|
281 | BellFeedbackPtr bell;
|
---|
282 | LedFeedbackPtr leds;
|
---|
283 | #ifdef XKB
|
---|
284 | struct _XkbInterest * xkb_interest;
|
---|
285 | #endif
|
---|
286 | DevUnion *devPrivates;
|
---|
287 | int nPrivates;
|
---|
288 | DeviceUnwrapProc unwrapProc;
|
---|
289 | } DeviceIntRec;
|
---|
290 |
|
---|
291 | typedef struct {
|
---|
292 | int numDevices; /* total number of devices */
|
---|
293 | DeviceIntPtr devices; /* all devices turned on */
|
---|
294 | DeviceIntPtr off_devices; /* all devices turned off */
|
---|
295 | DeviceIntPtr keyboard; /* the main one for the server */
|
---|
296 | DeviceIntPtr pointer;
|
---|
297 | } InputInfo;
|
---|
298 |
|
---|
299 | extern InputInfo inputInfo;
|
---|
300 |
|
---|
301 | /* for keeping the events for devices grabbed synchronously */
|
---|
302 | typedef struct _QdEvent *QdEventPtr;
|
---|
303 | typedef struct _QdEvent {
|
---|
304 | QdEventPtr next;
|
---|
305 | DeviceIntPtr device;
|
---|
306 | ScreenPtr pScreen; /* what screen the pointer was on */
|
---|
307 | unsigned long months; /* milliseconds is in the event */
|
---|
308 | xEvent *event;
|
---|
309 | int evcount;
|
---|
310 | } QdEventRec;
|
---|
311 |
|
---|
312 | #endif /* INPUTSTRUCT_H */
|
---|