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