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