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 | #include "privates.h"
|
---|
56 |
|
---|
57 | #define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
|
---|
58 |
|
---|
59 | #define SameClient(obj,client) \
|
---|
60 | (CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
|
---|
61 |
|
---|
62 | #define MAX_DEVICES 20
|
---|
63 |
|
---|
64 | #define EMASKSIZE MAX_DEVICES
|
---|
65 |
|
---|
66 | extern DevPrivateKey CoreDevicePrivateKey;
|
---|
67 |
|
---|
68 | /* Kludge: OtherClients and InputClients must be compatible, see code */
|
---|
69 |
|
---|
70 | typedef struct _OtherClients {
|
---|
71 | OtherClientsPtr next;
|
---|
72 | XID resource; /* id for putting into resource manager */
|
---|
73 | Mask mask;
|
---|
74 | } OtherClients;
|
---|
75 |
|
---|
76 | typedef struct _InputClients {
|
---|
77 | InputClientsPtr next;
|
---|
78 | XID resource; /* id for putting into resource manager */
|
---|
79 | Mask mask[EMASKSIZE];
|
---|
80 | } InputClients;
|
---|
81 |
|
---|
82 | typedef struct _OtherInputMasks {
|
---|
83 | Mask deliverableEvents[EMASKSIZE];
|
---|
84 | Mask inputEvents[EMASKSIZE];
|
---|
85 | Mask dontPropagateMask[EMASKSIZE];
|
---|
86 | InputClientsPtr inputClients;
|
---|
87 | } OtherInputMasks;
|
---|
88 |
|
---|
89 | /*
|
---|
90 | * The following structure gets used for both active and passive grabs. For
|
---|
91 | * active grabs some of the fields (e.g. modifiers) are not used. However,
|
---|
92 | * that is not much waste since there aren't many active grabs (one per
|
---|
93 | * keyboard/pointer device) going at once in the server.
|
---|
94 | */
|
---|
95 |
|
---|
96 | #define MasksPerDetailMask 8 /* 256 keycodes and 256 possible
|
---|
97 | modifier combinations, but only
|
---|
98 | 3 buttons. */
|
---|
99 |
|
---|
100 | typedef struct _DetailRec { /* Grab details may be bit masks */
|
---|
101 | unsigned short exact;
|
---|
102 | Mask *pMask;
|
---|
103 | } DetailRec;
|
---|
104 |
|
---|
105 | typedef struct _GrabRec {
|
---|
106 | GrabPtr next; /* for chain of passive grabs */
|
---|
107 | XID resource;
|
---|
108 | DeviceIntPtr device;
|
---|
109 | WindowPtr window;
|
---|
110 | unsigned ownerEvents:1;
|
---|
111 | unsigned keyboardMode:1;
|
---|
112 | unsigned pointerMode:1;
|
---|
113 | unsigned coreGrab:1; /* grab is on core device */
|
---|
114 | unsigned coreMods:1; /* modifiers are on core keyboard */
|
---|
115 | CARD8 type; /* event type */
|
---|
116 | DetailRec modifiersDetail;
|
---|
117 | DeviceIntPtr modifierDevice;
|
---|
118 | DetailRec detail; /* key or button */
|
---|
119 | WindowPtr confineTo; /* always NULL for keyboards */
|
---|
120 | CursorPtr cursor; /* always NULL for keyboards */
|
---|
121 | Mask eventMask;
|
---|
122 | } GrabRec;
|
---|
123 |
|
---|
124 | typedef struct _KeyClassRec {
|
---|
125 | CARD8 down[DOWN_LENGTH];
|
---|
126 | CARD8 postdown[DOWN_LENGTH];
|
---|
127 | KeyCode *modifierKeyMap;
|
---|
128 | KeySymsRec curKeySyms;
|
---|
129 | int modifierKeyCount[8];
|
---|
130 | CARD8 modifierMap[MAP_LENGTH];
|
---|
131 | CARD8 maxKeysPerModifier;
|
---|
132 | unsigned short state;
|
---|
133 | unsigned short prev_state;
|
---|
134 | #ifdef XKB
|
---|
135 | struct _XkbSrvInfo *xkbInfo;
|
---|
136 | #else
|
---|
137 | void *pad0;
|
---|
138 | #endif
|
---|
139 | } KeyClassRec, *KeyClassPtr;
|
---|
140 |
|
---|
141 | typedef struct _AxisInfo {
|
---|
142 | int resolution;
|
---|
143 | int min_resolution;
|
---|
144 | int max_resolution;
|
---|
145 | int min_value;
|
---|
146 | int max_value;
|
---|
147 | } AxisInfo, *AxisInfoPtr;
|
---|
148 |
|
---|
149 | typedef struct _ValuatorClassRec {
|
---|
150 | ValuatorMotionProcPtr GetMotionProc;
|
---|
151 | int numMotionEvents;
|
---|
152 | int first_motion;
|
---|
153 | int last_motion;
|
---|
154 | void *motion;
|
---|
155 |
|
---|
156 | WindowPtr motionHintWindow;
|
---|
157 |
|
---|
158 | AxisInfoPtr axes;
|
---|
159 | unsigned short numAxes;
|
---|
160 | int *axisVal;
|
---|
161 | int lastx, lasty; /* last event recorded, not posted to
|
---|
162 | * client; see dix/devices.c */
|
---|
163 | float dxremaind, dyremaind; /* for acceleration */
|
---|
164 | CARD8 mode;
|
---|
165 | } ValuatorClassRec, *ValuatorClassPtr;
|
---|
166 |
|
---|
167 | typedef struct _ButtonClassRec {
|
---|
168 | CARD8 numButtons;
|
---|
169 | CARD8 buttonsDown; /* number of buttons currently down */
|
---|
170 | unsigned short state;
|
---|
171 | Mask motionMask;
|
---|
172 | CARD8 down[DOWN_LENGTH];
|
---|
173 | CARD8 map[MAP_LENGTH];
|
---|
174 | #ifdef XKB
|
---|
175 | union _XkbAction *xkb_acts;
|
---|
176 | #else
|
---|
177 | void *pad0;
|
---|
178 | #endif
|
---|
179 | } ButtonClassRec, *ButtonClassPtr;
|
---|
180 |
|
---|
181 | typedef struct _FocusClassRec {
|
---|
182 | WindowPtr win;
|
---|
183 | int revert;
|
---|
184 | TimeStamp time;
|
---|
185 | WindowPtr *trace;
|
---|
186 | int traceSize;
|
---|
187 | int traceGood;
|
---|
188 | } FocusClassRec, *FocusClassPtr;
|
---|
189 |
|
---|
190 | typedef struct _ProximityClassRec {
|
---|
191 | char pad;
|
---|
192 | } ProximityClassRec, *ProximityClassPtr;
|
---|
193 |
|
---|
194 | typedef struct _AbsoluteClassRec {
|
---|
195 | /* Calibration. */
|
---|
196 | int min_x;
|
---|
197 | int max_x;
|
---|
198 | int min_y;
|
---|
199 | int max_y;
|
---|
200 | int flip_x;
|
---|
201 | int flip_y;
|
---|
202 | int rotation;
|
---|
203 | int button_threshold;
|
---|
204 |
|
---|
205 | /* Area. */
|
---|
206 | int offset_x;
|
---|
207 | int offset_y;
|
---|
208 | int width;
|
---|
209 | int height;
|
---|
210 | int screen;
|
---|
211 | XID following;
|
---|
212 | } AbsoluteClassRec, *AbsoluteClassPtr;
|
---|
213 |
|
---|
214 | typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr;
|
---|
215 | typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr;
|
---|
216 | typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr;
|
---|
217 | typedef struct _StringFeedbackClassRec *StringFeedbackPtr;
|
---|
218 | typedef struct _BellFeedbackClassRec *BellFeedbackPtr;
|
---|
219 | typedef struct _LedFeedbackClassRec *LedFeedbackPtr;
|
---|
220 |
|
---|
221 | typedef struct _KbdFeedbackClassRec {
|
---|
222 | BellProcPtr BellProc;
|
---|
223 | KbdCtrlProcPtr CtrlProc;
|
---|
224 | KeybdCtrl ctrl;
|
---|
225 | KbdFeedbackPtr next;
|
---|
226 | #ifdef XKB
|
---|
227 | struct _XkbSrvLedInfo *xkb_sli;
|
---|
228 | #else
|
---|
229 | void *pad0;
|
---|
230 | #endif
|
---|
231 | } KbdFeedbackClassRec;
|
---|
232 |
|
---|
233 | typedef struct _PtrFeedbackClassRec {
|
---|
234 | PtrCtrlProcPtr CtrlProc;
|
---|
235 | PtrCtrl ctrl;
|
---|
236 | PtrFeedbackPtr next;
|
---|
237 | } PtrFeedbackClassRec;
|
---|
238 |
|
---|
239 | typedef struct _IntegerFeedbackClassRec {
|
---|
240 | IntegerCtrlProcPtr CtrlProc;
|
---|
241 | IntegerCtrl ctrl;
|
---|
242 | IntegerFeedbackPtr next;
|
---|
243 | } IntegerFeedbackClassRec;
|
---|
244 |
|
---|
245 | typedef struct _StringFeedbackClassRec {
|
---|
246 | StringCtrlProcPtr CtrlProc;
|
---|
247 | StringCtrl ctrl;
|
---|
248 | StringFeedbackPtr next;
|
---|
249 | } StringFeedbackClassRec;
|
---|
250 |
|
---|
251 | typedef struct _BellFeedbackClassRec {
|
---|
252 | BellProcPtr BellProc;
|
---|
253 | BellCtrlProcPtr CtrlProc;
|
---|
254 | BellCtrl ctrl;
|
---|
255 | BellFeedbackPtr next;
|
---|
256 | } BellFeedbackClassRec;
|
---|
257 |
|
---|
258 | typedef struct _LedFeedbackClassRec {
|
---|
259 | LedCtrlProcPtr CtrlProc;
|
---|
260 | LedCtrl ctrl;
|
---|
261 | LedFeedbackPtr next;
|
---|
262 | #ifdef XKB
|
---|
263 | struct _XkbSrvLedInfo *xkb_sli;
|
---|
264 | #else
|
---|
265 | void *pad0;
|
---|
266 | #endif
|
---|
267 | } LedFeedbackClassRec;
|
---|
268 |
|
---|
269 | /* states for devices */
|
---|
270 |
|
---|
271 | #define NOT_GRABBED 0
|
---|
272 | #define THAWED 1
|
---|
273 | #define THAWED_BOTH 2 /* not a real state */
|
---|
274 | #define FREEZE_NEXT_EVENT 3
|
---|
275 | #define FREEZE_BOTH_NEXT_EVENT 4
|
---|
276 | #define FROZEN 5 /* any state >= has device frozen */
|
---|
277 | #define FROZEN_NO_EVENT 5
|
---|
278 | #define FROZEN_WITH_EVENT 6
|
---|
279 | #define THAW_OTHERS 7
|
---|
280 |
|
---|
281 | typedef struct _DeviceIntRec {
|
---|
282 | DeviceRec public;
|
---|
283 | DeviceIntPtr next;
|
---|
284 | TimeStamp grabTime;
|
---|
285 | Bool startup; /* true if needs to be turned on at
|
---|
286 | server intialization time */
|
---|
287 | DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is
|
---|
288 | used to initialize, turn on, or
|
---|
289 | turn off the device */
|
---|
290 | Bool inited; /* TRUE if INIT returns Success */
|
---|
291 | Bool enabled; /* TRUE if ON returns Success */
|
---|
292 | Bool coreEvents; /* TRUE if device also sends core */
|
---|
293 | GrabPtr grab; /* the grabber - used by DIX */
|
---|
294 | struct {
|
---|
295 | Bool frozen;
|
---|
296 | int state;
|
---|
297 | GrabPtr other; /* if other grab has this frozen */
|
---|
298 | xEvent *event; /* saved to be replayed */
|
---|
299 | int evcount;
|
---|
300 | } sync;
|
---|
301 | Atom type;
|
---|
302 | char *name;
|
---|
303 | CARD8 id;
|
---|
304 | CARD8 activatingKey;
|
---|
305 | Bool fromPassiveGrab;
|
---|
306 | GrabRec activeGrab;
|
---|
307 | void (*ActivateGrab) (
|
---|
308 | DeviceIntPtr /*device*/,
|
---|
309 | GrabPtr /*grab*/,
|
---|
310 | TimeStamp /*time*/,
|
---|
311 | Bool /*autoGrab*/);
|
---|
312 | void (*DeactivateGrab)(
|
---|
313 | DeviceIntPtr /*device*/);
|
---|
314 | KeyClassPtr key;
|
---|
315 | ValuatorClassPtr valuator;
|
---|
316 | ButtonClassPtr button;
|
---|
317 | FocusClassPtr focus;
|
---|
318 | ProximityClassPtr proximity;
|
---|
319 | AbsoluteClassPtr absolute;
|
---|
320 | KbdFeedbackPtr kbdfeed;
|
---|
321 | PtrFeedbackPtr ptrfeed;
|
---|
322 | IntegerFeedbackPtr intfeed;
|
---|
323 | StringFeedbackPtr stringfeed;
|
---|
324 | BellFeedbackPtr bell;
|
---|
325 | LedFeedbackPtr leds;
|
---|
326 | #ifdef XKB
|
---|
327 | struct _XkbInterest *xkb_interest;
|
---|
328 | #else
|
---|
329 | void *pad0;
|
---|
330 | #endif
|
---|
331 | char *config_info; /* used by the hotplug layer */
|
---|
332 | PrivateRec *devPrivates;
|
---|
333 | int nPrivates;
|
---|
334 | DeviceUnwrapProc unwrapProc;
|
---|
335 | } DeviceIntRec;
|
---|
336 |
|
---|
337 | typedef struct {
|
---|
338 | int numDevices; /* total number of devices */
|
---|
339 | DeviceIntPtr devices; /* all devices turned on */
|
---|
340 | DeviceIntPtr off_devices; /* all devices turned off */
|
---|
341 | DeviceIntPtr keyboard; /* the main one for the server */
|
---|
342 | DeviceIntPtr pointer;
|
---|
343 | } InputInfo;
|
---|
344 |
|
---|
345 | extern InputInfo inputInfo;
|
---|
346 |
|
---|
347 | /* for keeping the events for devices grabbed synchronously */
|
---|
348 | typedef struct _QdEvent *QdEventPtr;
|
---|
349 | typedef struct _QdEvent {
|
---|
350 | QdEventPtr next;
|
---|
351 | DeviceIntPtr device;
|
---|
352 | ScreenPtr pScreen; /* what screen the pointer was on */
|
---|
353 | unsigned long months; /* milliseconds is in the event */
|
---|
354 | xEvent *event;
|
---|
355 | int evcount;
|
---|
356 | } QdEventRec;
|
---|
357 |
|
---|
358 | #endif /* INPUTSTRUCT_H */
|
---|