1 | /* $Xorg: input.h,v 1.4 2001/02/09 02:05:15 xorgcvs 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 | /* $XFree86: xc/programs/Xserver/include/input.h,v 3.8 2003/04/27 21:31:04 herrb Exp $ */
|
---|
49 |
|
---|
50 | #ifndef INPUT_H
|
---|
51 | #define INPUT_H
|
---|
52 |
|
---|
53 | #include "misc.h"
|
---|
54 | #include "screenint.h"
|
---|
55 | #include <X11/Xmd.h>
|
---|
56 | #include <X11/Xproto.h>
|
---|
57 | #include "window.h" /* for WindowPtr */
|
---|
58 |
|
---|
59 | #define DEVICE_INIT 0
|
---|
60 | #define DEVICE_ON 1
|
---|
61 | #define DEVICE_OFF 2
|
---|
62 | #define DEVICE_CLOSE 3
|
---|
63 |
|
---|
64 | #define MAP_LENGTH 256
|
---|
65 | #define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */
|
---|
66 | #define NullGrab ((GrabPtr)NULL)
|
---|
67 | #define PointerRootWin ((WindowPtr)PointerRoot)
|
---|
68 | #define NoneWin ((WindowPtr)None)
|
---|
69 | #define NullDevice ((DevicePtr)NULL)
|
---|
70 |
|
---|
71 | #ifndef FollowKeyboard
|
---|
72 | #define FollowKeyboard 3
|
---|
73 | #endif
|
---|
74 | #ifndef FollowKeyboardWin
|
---|
75 | #define FollowKeyboardWin ((WindowPtr) FollowKeyboard)
|
---|
76 | #endif
|
---|
77 | #ifndef RevertToFollowKeyboard
|
---|
78 | #define RevertToFollowKeyboard 3
|
---|
79 | #endif
|
---|
80 |
|
---|
81 | typedef unsigned long Leds;
|
---|
82 | typedef struct _OtherClients *OtherClientsPtr;
|
---|
83 | typedef struct _InputClients *InputClientsPtr;
|
---|
84 | typedef struct _DeviceIntRec *DeviceIntPtr;
|
---|
85 |
|
---|
86 | typedef int (*DeviceProc)(
|
---|
87 | DeviceIntPtr /*device*/,
|
---|
88 | int /*what*/);
|
---|
89 |
|
---|
90 | typedef void (*ProcessInputProc)(
|
---|
91 | xEventPtr /*events*/,
|
---|
92 | DeviceIntPtr /*device*/,
|
---|
93 | int /*count*/);
|
---|
94 |
|
---|
95 | typedef Bool (*DeviceHandleProc)(
|
---|
96 | DeviceIntPtr /*device*/,
|
---|
97 | void* /*data*/
|
---|
98 | );
|
---|
99 |
|
---|
100 | typedef void (*DeviceUnwrapProc)(
|
---|
101 | DeviceIntPtr /*device*/,
|
---|
102 | DeviceHandleProc /*proc*/,
|
---|
103 | void* /*data*/
|
---|
104 | );
|
---|
105 |
|
---|
106 | typedef struct _DeviceRec {
|
---|
107 | pointer devicePrivate;
|
---|
108 | ProcessInputProc processInputProc; /* current */
|
---|
109 | ProcessInputProc realInputProc; /* deliver */
|
---|
110 | ProcessInputProc enqueueInputProc; /* enqueue */
|
---|
111 | Bool on; /* used by DDX to keep state */
|
---|
112 | } DeviceRec, *DevicePtr;
|
---|
113 |
|
---|
114 | typedef struct {
|
---|
115 | int click, bell, bell_pitch, bell_duration;
|
---|
116 | Bool autoRepeat;
|
---|
117 | unsigned char autoRepeats[32];
|
---|
118 | Leds leds;
|
---|
119 | unsigned char id;
|
---|
120 | } KeybdCtrl;
|
---|
121 |
|
---|
122 | typedef struct {
|
---|
123 | KeySym *map;
|
---|
124 | KeyCode minKeyCode,
|
---|
125 | maxKeyCode;
|
---|
126 | int mapWidth;
|
---|
127 | } KeySymsRec, *KeySymsPtr;
|
---|
128 |
|
---|
129 | typedef struct {
|
---|
130 | int num, den, threshold;
|
---|
131 | unsigned char id;
|
---|
132 | } PtrCtrl;
|
---|
133 |
|
---|
134 | typedef struct {
|
---|
135 | int resolution, min_value, max_value;
|
---|
136 | int integer_displayed;
|
---|
137 | unsigned char id;
|
---|
138 | } IntegerCtrl;
|
---|
139 |
|
---|
140 | typedef struct {
|
---|
141 | int max_symbols, num_symbols_supported;
|
---|
142 | int num_symbols_displayed;
|
---|
143 | KeySym *symbols_supported;
|
---|
144 | KeySym *symbols_displayed;
|
---|
145 | unsigned char id;
|
---|
146 | } StringCtrl;
|
---|
147 |
|
---|
148 | typedef struct {
|
---|
149 | int percent, pitch, duration;
|
---|
150 | unsigned char id;
|
---|
151 | } BellCtrl;
|
---|
152 |
|
---|
153 | typedef struct {
|
---|
154 | Leds led_values;
|
---|
155 | Mask led_mask;
|
---|
156 | unsigned char id;
|
---|
157 | } LedCtrl;
|
---|
158 |
|
---|
159 | extern int AllocateDevicePrivateIndex(void);
|
---|
160 | extern Bool AllocateDevicePrivate(DeviceIntPtr device, int index);
|
---|
161 | extern void ResetDevicePrivateIndex(void);
|
---|
162 |
|
---|
163 | extern KeybdCtrl defaultKeyboardControl;
|
---|
164 | extern PtrCtrl defaultPointerControl;
|
---|
165 |
|
---|
166 | #undef AddInputDevice
|
---|
167 | extern DevicePtr AddInputDevice(
|
---|
168 | DeviceProc /*deviceProc*/,
|
---|
169 | Bool /*autoStart*/);
|
---|
170 |
|
---|
171 | #define AddInputDevice(deviceProc, autoStart) \
|
---|
172 | _AddInputDevice(deviceProc, autoStart)
|
---|
173 |
|
---|
174 | extern DeviceIntPtr _AddInputDevice(
|
---|
175 | DeviceProc /*deviceProc*/,
|
---|
176 | Bool /*autoStart*/);
|
---|
177 |
|
---|
178 | extern Bool EnableDevice(
|
---|
179 | DeviceIntPtr /*device*/);
|
---|
180 |
|
---|
181 | extern Bool DisableDevice(
|
---|
182 | DeviceIntPtr /*device*/);
|
---|
183 |
|
---|
184 | extern int InitAndStartDevices(void);
|
---|
185 |
|
---|
186 | extern void CloseDownDevices(void);
|
---|
187 |
|
---|
188 | extern void RemoveDevice(
|
---|
189 | DeviceIntPtr /*dev*/);
|
---|
190 |
|
---|
191 | extern int NumMotionEvents(void);
|
---|
192 |
|
---|
193 | #undef RegisterPointerDevice
|
---|
194 | extern void RegisterPointerDevice(
|
---|
195 | DevicePtr /*device*/);
|
---|
196 |
|
---|
197 | #define RegisterPointerDevice(device) \
|
---|
198 | _RegisterPointerDevice(device)
|
---|
199 |
|
---|
200 | extern void _RegisterPointerDevice(
|
---|
201 | DeviceIntPtr /*device*/);
|
---|
202 |
|
---|
203 | #undef RegisterKeyboardDevice
|
---|
204 | extern void RegisterKeyboardDevice(
|
---|
205 | DevicePtr /*device*/);
|
---|
206 |
|
---|
207 | #define RegisterKeyboardDevice(device) \
|
---|
208 | _RegisterKeyboardDevice(device)
|
---|
209 |
|
---|
210 | extern void _RegisterKeyboardDevice(
|
---|
211 | DeviceIntPtr /*device*/);
|
---|
212 |
|
---|
213 | extern DevicePtr LookupKeyboardDevice(void);
|
---|
214 |
|
---|
215 | extern DevicePtr LookupPointerDevice(void);
|
---|
216 |
|
---|
217 | extern DevicePtr LookupDevice(
|
---|
218 | int /* id */);
|
---|
219 |
|
---|
220 | extern void QueryMinMaxKeyCodes(
|
---|
221 | KeyCode* /*minCode*/,
|
---|
222 | KeyCode* /*maxCode*/);
|
---|
223 |
|
---|
224 | extern Bool SetKeySymsMap(
|
---|
225 | KeySymsPtr /*dst*/,
|
---|
226 | KeySymsPtr /*src*/);
|
---|
227 |
|
---|
228 | extern Bool InitKeyClassDeviceStruct(
|
---|
229 | DeviceIntPtr /*device*/,
|
---|
230 | KeySymsPtr /*pKeySyms*/,
|
---|
231 | CARD8 /*pModifiers*/[]);
|
---|
232 |
|
---|
233 | extern Bool InitButtonClassDeviceStruct(
|
---|
234 | DeviceIntPtr /*device*/,
|
---|
235 | int /*numButtons*/,
|
---|
236 | CARD8* /*map*/);
|
---|
237 |
|
---|
238 | typedef int (*ValuatorMotionProcPtr)(
|
---|
239 | DeviceIntPtr /*pdevice*/,
|
---|
240 | xTimecoord * /*coords*/,
|
---|
241 | unsigned long /*start*/,
|
---|
242 | unsigned long /*stop*/,
|
---|
243 | ScreenPtr /*pScreen*/);
|
---|
244 |
|
---|
245 | extern Bool InitValuatorClassDeviceStruct(
|
---|
246 | DeviceIntPtr /*device*/,
|
---|
247 | int /*numAxes*/,
|
---|
248 | ValuatorMotionProcPtr /* motionProc */,
|
---|
249 | int /*numMotionEvents*/,
|
---|
250 | int /*mode*/);
|
---|
251 |
|
---|
252 | extern Bool InitFocusClassDeviceStruct(
|
---|
253 | DeviceIntPtr /*device*/);
|
---|
254 |
|
---|
255 | typedef void (*BellProcPtr)(
|
---|
256 | int /*percent*/,
|
---|
257 | DeviceIntPtr /*device*/,
|
---|
258 | pointer /*ctrl*/,
|
---|
259 | int);
|
---|
260 |
|
---|
261 | typedef void (*KbdCtrlProcPtr)(
|
---|
262 | DeviceIntPtr /*device*/,
|
---|
263 | KeybdCtrl * /*ctrl*/);
|
---|
264 |
|
---|
265 | extern Bool InitKbdFeedbackClassDeviceStruct(
|
---|
266 | DeviceIntPtr /*device*/,
|
---|
267 | BellProcPtr /*bellProc*/,
|
---|
268 | KbdCtrlProcPtr /*controlProc*/);
|
---|
269 |
|
---|
270 | typedef void (*PtrCtrlProcPtr)(
|
---|
271 | DeviceIntPtr /*device*/,
|
---|
272 | PtrCtrl * /*ctrl*/);
|
---|
273 |
|
---|
274 | extern Bool InitPtrFeedbackClassDeviceStruct(
|
---|
275 | DeviceIntPtr /*device*/,
|
---|
276 | PtrCtrlProcPtr /*controlProc*/);
|
---|
277 |
|
---|
278 | typedef void (*StringCtrlProcPtr)(
|
---|
279 | DeviceIntPtr /*device*/,
|
---|
280 | StringCtrl * /*ctrl*/);
|
---|
281 |
|
---|
282 | extern Bool InitStringFeedbackClassDeviceStruct(
|
---|
283 | DeviceIntPtr /*device*/,
|
---|
284 | StringCtrlProcPtr /*controlProc*/,
|
---|
285 | int /*max_symbols*/,
|
---|
286 | int /*num_symbols_supported*/,
|
---|
287 | KeySym* /*symbols*/);
|
---|
288 |
|
---|
289 | typedef void (*BellCtrlProcPtr)(
|
---|
290 | DeviceIntPtr /*device*/,
|
---|
291 | BellCtrl * /*ctrl*/);
|
---|
292 |
|
---|
293 | extern Bool InitBellFeedbackClassDeviceStruct(
|
---|
294 | DeviceIntPtr /*device*/,
|
---|
295 | BellProcPtr /*bellProc*/,
|
---|
296 | BellCtrlProcPtr /*controlProc*/);
|
---|
297 |
|
---|
298 | typedef void (*LedCtrlProcPtr)(
|
---|
299 | DeviceIntPtr /*device*/,
|
---|
300 | LedCtrl * /*ctrl*/);
|
---|
301 |
|
---|
302 | extern Bool InitLedFeedbackClassDeviceStruct(
|
---|
303 | DeviceIntPtr /*device*/,
|
---|
304 | LedCtrlProcPtr /*controlProc*/);
|
---|
305 |
|
---|
306 | typedef void (*IntegerCtrlProcPtr)(
|
---|
307 | DeviceIntPtr /*device*/,
|
---|
308 | IntegerCtrl * /*ctrl*/);
|
---|
309 |
|
---|
310 |
|
---|
311 | extern Bool InitIntegerFeedbackClassDeviceStruct(
|
---|
312 | DeviceIntPtr /*device*/,
|
---|
313 | IntegerCtrlProcPtr /*controlProc*/);
|
---|
314 |
|
---|
315 | extern Bool InitPointerDeviceStruct(
|
---|
316 | DevicePtr /*device*/,
|
---|
317 | CARD8* /*map*/,
|
---|
318 | int /*numButtons*/,
|
---|
319 | ValuatorMotionProcPtr /*motionProc*/,
|
---|
320 | PtrCtrlProcPtr /*controlProc*/,
|
---|
321 | int /*numMotionEvents*/);
|
---|
322 |
|
---|
323 | extern Bool InitKeyboardDeviceStruct(
|
---|
324 | DevicePtr /*device*/,
|
---|
325 | KeySymsPtr /*pKeySyms*/,
|
---|
326 | CARD8 /*pModifiers*/[],
|
---|
327 | BellProcPtr /*bellProc*/,
|
---|
328 | KbdCtrlProcPtr /*controlProc*/);
|
---|
329 |
|
---|
330 | extern void SendMappingNotify(
|
---|
331 | unsigned int /*request*/,
|
---|
332 | unsigned int /*firstKeyCode*/,
|
---|
333 | unsigned int /*count*/,
|
---|
334 | ClientPtr /* client */);
|
---|
335 |
|
---|
336 | extern Bool BadDeviceMap(
|
---|
337 | BYTE* /*buff*/,
|
---|
338 | int /*length*/,
|
---|
339 | unsigned /*low*/,
|
---|
340 | unsigned /*high*/,
|
---|
341 | XID* /*errval*/);
|
---|
342 |
|
---|
343 | extern Bool AllModifierKeysAreUp(
|
---|
344 | DeviceIntPtr /*device*/,
|
---|
345 | CARD8* /*map1*/,
|
---|
346 | int /*per1*/,
|
---|
347 | CARD8* /*map2*/,
|
---|
348 | int /*per2*/);
|
---|
349 |
|
---|
350 | extern void NoteLedState(
|
---|
351 | DeviceIntPtr /*keybd*/,
|
---|
352 | int /*led*/,
|
---|
353 | Bool /*on*/);
|
---|
354 |
|
---|
355 | extern void MaybeStopHint(
|
---|
356 | DeviceIntPtr /*device*/,
|
---|
357 | ClientPtr /*client*/);
|
---|
358 |
|
---|
359 | extern void ProcessPointerEvent(
|
---|
360 | xEventPtr /*xE*/,
|
---|
361 | DeviceIntPtr /*mouse*/,
|
---|
362 | int /*count*/);
|
---|
363 |
|
---|
364 | extern void ProcessKeyboardEvent(
|
---|
365 | xEventPtr /*xE*/,
|
---|
366 | DeviceIntPtr /*keybd*/,
|
---|
367 | int /*count*/);
|
---|
368 |
|
---|
369 | #ifdef XKB
|
---|
370 | extern void CoreProcessPointerEvent(
|
---|
371 | xEventPtr /*xE*/,
|
---|
372 | DeviceIntPtr /*mouse*/,
|
---|
373 | int /*count*/);
|
---|
374 |
|
---|
375 | extern void CoreProcessKeyboardEvent(
|
---|
376 | xEventPtr /*xE*/,
|
---|
377 | DeviceIntPtr /*keybd*/,
|
---|
378 | int /*count*/);
|
---|
379 | #endif
|
---|
380 |
|
---|
381 | extern Bool LegalModifier(
|
---|
382 | unsigned int /*key*/,
|
---|
383 | DevicePtr /*pDev*/);
|
---|
384 |
|
---|
385 | extern void ProcessInputEvents(void);
|
---|
386 |
|
---|
387 | extern void InitInput(
|
---|
388 | int /*argc*/,
|
---|
389 | char ** /*argv*/);
|
---|
390 |
|
---|
391 | #endif /* INPUT_H */
|
---|