1 /* $XConsortium: input.h /main/22 1996/09/25 00:50:39 dpw $ */
2 /* $XFree86: xc/programs/Xserver/include/input.h,v 3.4 1996/12/23 07:09:28 dawes Exp $ */
3 /************************************************************
5 Copyright (c) 1987 X Consortium
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 Except as contained in this notice, the name of the X Consortium shall not be
25 used in advertising or otherwise to promote the sale, use or other dealings
26 in this Software without prior written authorization from the X Consortium.
29 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
33 Permission to use, copy, modify, and distribute this software and its
34 documentation for any purpose and without fee is hereby granted,
35 provided that the above copyright notice appear in all copies and that
36 both that copyright notice and this permission notice appear in
37 supporting documentation, and that the name of Digital not be
38 used in advertising or publicity pertaining to distribution of the
39 software without specific, written prior permission.
41 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
42 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
43 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
44 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
45 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
46 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
49 ********************************************************/
54 #include "screenint.h"
56 #include "X11/Xproto.h"
57 #include "window.h" /* for WindowPtr */
62 #define DEVICE_CLOSE 3
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)
71 #ifndef FollowKeyboard
72 #define FollowKeyboard 3
74 #ifndef FollowKeyboardWin
75 #define FollowKeyboardWin ((WindowPtr) FollowKeyboard)
77 #ifndef RevertToFollowKeyboard
78 #define RevertToFollowKeyboard 3
81 typedef unsigned long Leds;
82 typedef struct _OtherClients *OtherClientsPtr;
83 typedef struct _InputClients *InputClientsPtr;
84 typedef struct _DeviceIntRec *DeviceIntPtr;
86 typedef int (*DeviceProc)(
87 #if NeedNestedPrototypes
88 DeviceIntPtr /*device*/,
93 typedef void (*ProcessInputProc)(
94 #if NeedNestedPrototypes
96 DeviceIntPtr /*device*/,
101 typedef struct _DeviceRec {
102 pointer devicePrivate;
103 ProcessInputProc processInputProc; /* current */
104 ProcessInputProc realInputProc; /* deliver */
105 ProcessInputProc enqueueInputProc; /* enqueue */
106 Bool on; /* used by DDX to keep state */
107 } DeviceRec, *DevicePtr;
110 int click, bell, bell_pitch, bell_duration;
112 unsigned char autoRepeats[32];
122 } KeySymsRec, *KeySymsPtr;
125 int num, den, threshold;
130 int resolution, min_value, max_value;
131 int integer_displayed;
136 int max_symbols, num_symbols_supported;
137 int num_symbols_displayed;
138 KeySym *symbols_supported;
139 KeySym *symbols_displayed;
144 int percent, pitch, duration;
154 extern KeybdCtrl defaultKeyboardControl;
155 extern PtrCtrl defaultPointerControl;
157 #undef AddInputDevice
158 extern DevicePtr AddInputDevice(
159 #if NeedFunctionPrototypes
160 DeviceProc /*deviceProc*/,
165 #define AddInputDevice(deviceProc, autoStart) \
166 _AddInputDevice(deviceProc, autoStart)
168 extern DeviceIntPtr _AddInputDevice(
169 #if NeedFunctionPrototypes
170 DeviceProc /*deviceProc*/,
175 extern Bool EnableDevice(
176 #if NeedFunctionPrototypes
177 DeviceIntPtr /*device*/
181 extern Bool DisableDevice(
182 #if NeedFunctionPrototypes
183 DeviceIntPtr /*device*/
187 extern int InitAndStartDevices(
188 #if NeedFunctionPrototypes
193 extern void CloseDownDevices(
194 #if NeedFunctionPrototypes
199 extern void RemoveDevice(
200 #if NeedFunctionPrototypes
205 extern int NumMotionEvents(
206 #if NeedFunctionPrototypes
211 #undef RegisterPointerDevice
212 extern void RegisterPointerDevice(
213 #if NeedFunctionPrototypes
218 #define RegisterPointerDevice(device) \
219 _RegisterPointerDevice(device)
221 extern void _RegisterPointerDevice(
222 #if NeedFunctionPrototypes
223 DeviceIntPtr /*device*/
227 #undef RegisterKeyboardDevice
228 extern void RegisterKeyboardDevice(
229 #if NeedFunctionPrototypes
234 #define RegisterKeyboardDevice(device) \
235 _RegisterKeyboardDevice(device)
237 extern void _RegisterKeyboardDevice(
238 #if NeedFunctionPrototypes
239 DeviceIntPtr /*device*/
243 extern DevicePtr LookupKeyboardDevice(
244 #if NeedFunctionPrototypes
249 extern DevicePtr LookupPointerDevice(
250 #if NeedFunctionPrototypes
255 extern DevicePtr LookupDevice(
256 #if NeedFunctionPrototypes
261 extern void QueryMinMaxKeyCodes(
262 #if NeedFunctionPrototypes
263 KeyCode* /*minCode*/,
268 extern Bool SetKeySymsMap(
269 #if NeedFunctionPrototypes
275 extern Bool InitKeyClassDeviceStruct(
276 #if NeedFunctionPrototypes
277 DeviceIntPtr /*device*/,
278 KeySymsPtr /*pKeySyms*/,
279 CARD8 /*pModifiers*/[]
283 extern Bool InitButtonClassDeviceStruct(
284 #if NeedFunctionPrototypes
285 DeviceIntPtr /*device*/,
291 typedef int (*ValuatorMotionProcPtr)(
292 #if NeedNestedPrototypes
293 DeviceIntPtr /*pdevice*/,
294 xTimecoord * /*coords*/,
295 unsigned long /*start*/,
296 unsigned long /*stop*/,
297 ScreenPtr /*pScreen*/
301 extern Bool InitValuatorClassDeviceStruct(
302 #if NeedFunctionPrototypes
303 DeviceIntPtr /*device*/,
305 ValuatorMotionProcPtr /* motionProc */,
306 int /*numMotionEvents*/,
311 extern Bool InitFocusClassDeviceStruct(
312 #if NeedFunctionPrototypes
313 DeviceIntPtr /*device*/
317 typedef void (*BellProcPtr)(
318 #if NeedNestedPrototypes
320 DeviceIntPtr /*device*/,
326 typedef void (*KbdCtrlProcPtr)(
327 #if NeedNestedPrototypes
328 DeviceIntPtr /*device*/,
333 extern Bool InitKbdFeedbackClassDeviceStruct(
334 #if NeedFunctionPrototypes
335 DeviceIntPtr /*device*/,
336 BellProcPtr /*bellProc*/,
337 KbdCtrlProcPtr /*controlProc*/
341 typedef void (*PtrCtrlProcPtr)(
342 #if NeedNestedPrototypes
343 DeviceIntPtr /*device*/,
348 extern Bool InitPtrFeedbackClassDeviceStruct(
349 #if NeedFunctionPrototypes
350 DeviceIntPtr /*device*/,
351 PtrCtrlProcPtr /*controlProc*/
355 typedef void (*StringCtrlProcPtr)(
356 #if NeedNestedPrototypes
357 DeviceIntPtr /*device*/,
358 StringCtrl * /*ctrl*/
362 extern Bool InitStringFeedbackClassDeviceStruct(
363 #if NeedFunctionPrototypes
364 DeviceIntPtr /*device*/,
365 StringCtrlProcPtr /*controlProc*/,
367 int /*num_symbols_supported*/,
372 typedef void (*BellCtrlProcPtr)(
373 #if NeedNestedPrototypes
374 DeviceIntPtr /*device*/,
379 extern Bool InitBellFeedbackClassDeviceStruct(
380 #if NeedFunctionPrototypes
381 DeviceIntPtr /*device*/,
382 BellProcPtr /*bellProc*/,
383 BellCtrlProcPtr /*controlProc*/
387 typedef void (*LedCtrlProcPtr)(
388 #if NeedNestedPrototypes
389 DeviceIntPtr /*device*/,
394 extern Bool InitLedFeedbackClassDeviceStruct(
395 #if NeedFunctionPrototypes
396 DeviceIntPtr /*device*/,
397 LedCtrlProcPtr /*controlProc*/
401 typedef void (*IntegerCtrlProcPtr)(
402 #if NeedNestedPrototypes
403 DeviceIntPtr /*device*/,
404 IntegerCtrl * /*ctrl*/
409 extern Bool InitIntegerFeedbackClassDeviceStruct(
410 #if NeedFunctionPrototypes
411 DeviceIntPtr /*device*/,
412 IntegerCtrlProcPtr /*controlProc*/
416 extern Bool InitPointerDeviceStruct(
417 #if NeedFunctionPrototypes
418 DevicePtr /*device*/,
421 ValuatorMotionProcPtr /*motionProc*/,
422 PtrCtrlProcPtr /*controlProc*/,
423 int /*numMotionEvents*/
427 extern Bool InitKeyboardDeviceStruct(
428 #if NeedFunctionPrototypes
429 DevicePtr /*device*/,
430 KeySymsPtr /*pKeySyms*/,
431 CARD8 /*pModifiers*/[],
432 BellProcPtr /*bellProc*/,
433 KbdCtrlProcPtr /*controlProc*/
437 extern void SendMappingNotify(
438 #if NeedFunctionPrototypes
439 unsigned int /*request*/,
440 unsigned int /*firstKeyCode*/,
441 unsigned int /*count*/,
442 ClientPtr /* client */
446 extern Bool BadDeviceMap(
447 #if NeedFunctionPrototypes
456 extern Bool AllModifierKeysAreUp(
457 #if NeedFunctionPrototypes
458 DeviceIntPtr /*device*/,
466 extern void NoteLedState(
467 #if NeedFunctionPrototypes
468 DeviceIntPtr /*keybd*/,
474 extern void MaybeStopHint(
475 #if NeedFunctionPrototypes
476 DeviceIntPtr /*device*/,
481 extern void ProcessPointerEvent(
482 #if NeedFunctionPrototypes
484 DeviceIntPtr /*mouse*/,
489 extern void ProcessKeyboardEvent(
490 #if NeedFunctionPrototypes
492 DeviceIntPtr /*keybd*/,
498 extern void CoreProcessPointerEvent(
499 #if NeedFunctionPrototypes
501 DeviceIntPtr /*mouse*/,
506 extern void CoreProcessKeyboardEvent(
507 #if NeedFunctionPrototypes
509 DeviceIntPtr /*keybd*/,
515 extern Bool LegalModifier(
516 #if NeedFunctionPrototypes
517 unsigned int /*key*/,
522 extern void ProcessInputEvents(
523 #if NeedFunctionPrototypes
528 extern void InitInput(
529 #if NeedFunctionPrototypes