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 <stdint.h>
|
---|
56 | #include "window.h" /* for WindowPtr */
|
---|
57 | #include "xkbrules.h"
|
---|
58 | #include "events.h"
|
---|
59 |
|
---|
60 | #define DEVICE_INIT 0
|
---|
61 | #define DEVICE_ON 1
|
---|
62 | #define DEVICE_OFF 2
|
---|
63 | #define DEVICE_CLOSE 3
|
---|
64 |
|
---|
65 | #define POINTER_RELATIVE (1 << 1)
|
---|
66 | #define POINTER_ABSOLUTE (1 << 2)
|
---|
67 | #define POINTER_ACCELERATE (1 << 3)
|
---|
68 | #define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */
|
---|
69 |
|
---|
70 | /*int constants for pointer acceleration schemes*/
|
---|
71 | #define PtrAccelNoOp 0
|
---|
72 | #define PtrAccelPredictable 1
|
---|
73 | #define PtrAccelLightweight 2
|
---|
74 | #define PtrAccelDefault PtrAccelPredictable
|
---|
75 |
|
---|
76 | #define MAX_VALUATORS 36
|
---|
77 | /* Maximum number of valuators, divided by six, rounded up, to get number
|
---|
78 | * of events. */
|
---|
79 | #define MAX_VALUATOR_EVENTS 6
|
---|
80 | #define MAX_BUTTONS 256 /* completely arbitrarily chosen */
|
---|
81 |
|
---|
82 | #define NO_AXIS_LIMITS -1
|
---|
83 |
|
---|
84 | #define MAP_LENGTH 256
|
---|
85 | #define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */
|
---|
86 | #define NullGrab ((GrabPtr)NULL)
|
---|
87 | #define PointerRootWin ((WindowPtr)PointerRoot)
|
---|
88 | #define NoneWin ((WindowPtr)None)
|
---|
89 | #define NullDevice ((DevicePtr)NULL)
|
---|
90 |
|
---|
91 | #ifndef FollowKeyboard
|
---|
92 | #define FollowKeyboard 3
|
---|
93 | #endif
|
---|
94 | #ifndef FollowKeyboardWin
|
---|
95 | #define FollowKeyboardWin ((WindowPtr) FollowKeyboard)
|
---|
96 | #endif
|
---|
97 | #ifndef RevertToFollowKeyboard
|
---|
98 | #define RevertToFollowKeyboard 3
|
---|
99 | #endif
|
---|
100 |
|
---|
101 | typedef unsigned long Leds;
|
---|
102 | typedef struct _OtherClients *OtherClientsPtr;
|
---|
103 | typedef struct _InputClients *InputClientsPtr;
|
---|
104 | typedef struct _DeviceIntRec *DeviceIntPtr;
|
---|
105 | typedef struct _ClassesRec *ClassesPtr;
|
---|
106 | typedef struct _SpriteRec *SpritePtr;
|
---|
107 | typedef union _GrabMask GrabMask;
|
---|
108 |
|
---|
109 | typedef struct _EventList {
|
---|
110 | xEvent* event;
|
---|
111 | int evlen; /* length of allocated memory for event in bytes. This is not
|
---|
112 | the actual length of the event. The event's actual length is
|
---|
113 | 32 for standard events or 32 +
|
---|
114 | ((xGenericEvent*)event)->length * 4 for GenericEvents.
|
---|
115 | For events in the EQ, the length is
|
---|
116 | ((InternalEvent*)event)->u.any.length */
|
---|
117 | } EventList, *EventListPtr;
|
---|
118 |
|
---|
119 | /* The DIX stores incoming input events in this list */
|
---|
120 | extern EventListPtr InputEventList;
|
---|
121 | extern int InputEventListLen;
|
---|
122 |
|
---|
123 | typedef int (*DeviceProc)(
|
---|
124 | DeviceIntPtr /*device*/,
|
---|
125 | int /*what*/);
|
---|
126 |
|
---|
127 | typedef void (*ProcessInputProc)(
|
---|
128 | InternalEvent * /*event*/,
|
---|
129 | DeviceIntPtr /*device*/);
|
---|
130 |
|
---|
131 | typedef Bool (*DeviceHandleProc)(
|
---|
132 | DeviceIntPtr /*device*/,
|
---|
133 | void* /*data*/
|
---|
134 | );
|
---|
135 |
|
---|
136 | typedef void (*DeviceUnwrapProc)(
|
---|
137 | DeviceIntPtr /*device*/,
|
---|
138 | DeviceHandleProc /*proc*/,
|
---|
139 | void* /*data*/
|
---|
140 | );
|
---|
141 |
|
---|
142 | /* pointer acceleration handling */
|
---|
143 | typedef void (*PointerAccelSchemeProc)(
|
---|
144 | DeviceIntPtr /*pDev*/,
|
---|
145 | int /*first_valuator*/,
|
---|
146 | int /*num_valuators*/,
|
---|
147 | int* /*valuators*/,
|
---|
148 | int /*evtime*/);
|
---|
149 |
|
---|
150 | typedef void (*DeviceCallbackProc)(
|
---|
151 | DeviceIntPtr /*pDev*/);
|
---|
152 |
|
---|
153 | typedef struct _DeviceRec {
|
---|
154 | pointer devicePrivate;
|
---|
155 | ProcessInputProc processInputProc; /* current */
|
---|
156 | ProcessInputProc realInputProc; /* deliver */
|
---|
157 | ProcessInputProc enqueueInputProc; /* enqueue */
|
---|
158 | Bool on; /* used by DDX to keep state */
|
---|
159 | } DeviceRec, *DevicePtr;
|
---|
160 |
|
---|
161 | typedef struct _ValuatorMask ValuatorMask;
|
---|
162 |
|
---|
163 | typedef struct {
|
---|
164 | int click, bell, bell_pitch, bell_duration;
|
---|
165 | Bool autoRepeat;
|
---|
166 | unsigned char autoRepeats[32];
|
---|
167 | Leds leds;
|
---|
168 | unsigned char id;
|
---|
169 | } KeybdCtrl;
|
---|
170 |
|
---|
171 | typedef struct {
|
---|
172 | KeySym *map;
|
---|
173 | KeyCode minKeyCode,
|
---|
174 | maxKeyCode;
|
---|
175 | int mapWidth;
|
---|
176 | } KeySymsRec, *KeySymsPtr;
|
---|
177 |
|
---|
178 | typedef struct {
|
---|
179 | int num, den, threshold;
|
---|
180 | unsigned char id;
|
---|
181 | } PtrCtrl;
|
---|
182 |
|
---|
183 | typedef struct {
|
---|
184 | int resolution, min_value, max_value;
|
---|
185 | int integer_displayed;
|
---|
186 | unsigned char id;
|
---|
187 | } IntegerCtrl;
|
---|
188 |
|
---|
189 | typedef struct {
|
---|
190 | int max_symbols, num_symbols_supported;
|
---|
191 | int num_symbols_displayed;
|
---|
192 | KeySym *symbols_supported;
|
---|
193 | KeySym *symbols_displayed;
|
---|
194 | unsigned char id;
|
---|
195 | } StringCtrl;
|
---|
196 |
|
---|
197 | typedef struct {
|
---|
198 | int percent, pitch, duration;
|
---|
199 | unsigned char id;
|
---|
200 | } BellCtrl;
|
---|
201 |
|
---|
202 | typedef struct {
|
---|
203 | Leds led_values;
|
---|
204 | Mask led_mask;
|
---|
205 | unsigned char id;
|
---|
206 | } LedCtrl;
|
---|
207 |
|
---|
208 | extern _X_EXPORT KeybdCtrl defaultKeyboardControl;
|
---|
209 | extern _X_EXPORT PtrCtrl defaultPointerControl;
|
---|
210 |
|
---|
211 | typedef struct _InputOption {
|
---|
212 | char *key;
|
---|
213 | char *value;
|
---|
214 | struct _InputOption *next;
|
---|
215 | } InputOption;
|
---|
216 |
|
---|
217 | typedef struct _InputAttributes {
|
---|
218 | char *product;
|
---|
219 | char *vendor;
|
---|
220 | char *device;
|
---|
221 | char *pnp_id;
|
---|
222 | char *usb_id;
|
---|
223 | char **tags; /* null-terminated */
|
---|
224 | uint32_t flags;
|
---|
225 | } InputAttributes;
|
---|
226 |
|
---|
227 | #define ATTR_KEYBOARD (1<<0)
|
---|
228 | #define ATTR_POINTER (1<<1)
|
---|
229 | #define ATTR_JOYSTICK (1<<2)
|
---|
230 | #define ATTR_TABLET (1<<3)
|
---|
231 | #define ATTR_TOUCHPAD (1<<4)
|
---|
232 | #define ATTR_TOUCHSCREEN (1<<5)
|
---|
233 |
|
---|
234 | /* Key/Button has been run through all input processing and events sent to clients. */
|
---|
235 | #define KEY_PROCESSED 1
|
---|
236 | #define BUTTON_PROCESSED 1
|
---|
237 | /* Key/Button has not been fully processed, no events have been sent. */
|
---|
238 | #define KEY_POSTED 2
|
---|
239 | #define BUTTON_POSTED 2
|
---|
240 |
|
---|
241 | extern void set_key_down(DeviceIntPtr pDev, int key_code, int type);
|
---|
242 | extern void set_key_up(DeviceIntPtr pDev, int key_code, int type);
|
---|
243 | extern int key_is_down(DeviceIntPtr pDev, int key_code, int type);
|
---|
244 | extern void set_button_down(DeviceIntPtr pDev, int button, int type);
|
---|
245 | extern void set_button_up(DeviceIntPtr pDev, int button, int type);
|
---|
246 | extern int button_is_down(DeviceIntPtr pDev, int button, int type);
|
---|
247 |
|
---|
248 | extern void InitCoreDevices(void);
|
---|
249 | extern void InitXTestDevices(void);
|
---|
250 |
|
---|
251 | extern _X_EXPORT DeviceIntPtr AddInputDevice(
|
---|
252 | ClientPtr /*client*/,
|
---|
253 | DeviceProc /*deviceProc*/,
|
---|
254 | Bool /*autoStart*/);
|
---|
255 |
|
---|
256 | extern _X_EXPORT Bool EnableDevice(
|
---|
257 | DeviceIntPtr /*device*/,
|
---|
258 | BOOL /* sendevent */);
|
---|
259 |
|
---|
260 | extern _X_EXPORT Bool ActivateDevice(
|
---|
261 | DeviceIntPtr /*device*/,
|
---|
262 | BOOL /* sendevent */);
|
---|
263 |
|
---|
264 | extern _X_EXPORT Bool DisableDevice(
|
---|
265 | DeviceIntPtr /*device*/,
|
---|
266 | BOOL /* sendevent */);
|
---|
267 |
|
---|
268 | extern int InitAndStartDevices(void);
|
---|
269 |
|
---|
270 | extern void CloseDownDevices(void);
|
---|
271 |
|
---|
272 | extern void UndisplayDevices(void);
|
---|
273 |
|
---|
274 | extern _X_EXPORT int RemoveDevice(
|
---|
275 | DeviceIntPtr /*dev*/,
|
---|
276 | BOOL /* sendevent */);
|
---|
277 |
|
---|
278 | extern _X_EXPORT int NumMotionEvents(void);
|
---|
279 |
|
---|
280 | extern _X_EXPORT int dixLookupDevice(
|
---|
281 | DeviceIntPtr * /* dev */,
|
---|
282 | int /* id */,
|
---|
283 | ClientPtr /* client */,
|
---|
284 | Mask /* access_mode */);
|
---|
285 |
|
---|
286 | extern _X_EXPORT void QueryMinMaxKeyCodes(
|
---|
287 | KeyCode* /*minCode*/,
|
---|
288 | KeyCode* /*maxCode*/);
|
---|
289 |
|
---|
290 | extern _X_EXPORT Bool SetKeySymsMap(
|
---|
291 | KeySymsPtr /*dst*/,
|
---|
292 | KeySymsPtr /*src*/);
|
---|
293 |
|
---|
294 | extern _X_EXPORT Bool InitButtonClassDeviceStruct(
|
---|
295 | DeviceIntPtr /*device*/,
|
---|
296 | int /*numButtons*/,
|
---|
297 | Atom* /* labels */,
|
---|
298 | CARD8* /*map*/);
|
---|
299 |
|
---|
300 | extern _X_EXPORT Bool InitValuatorClassDeviceStruct(
|
---|
301 | DeviceIntPtr /*device*/,
|
---|
302 | int /*numAxes*/,
|
---|
303 | Atom* /* labels */,
|
---|
304 | int /*numMotionEvents*/,
|
---|
305 | int /*mode*/);
|
---|
306 |
|
---|
307 | extern _X_EXPORT Bool InitPointerAccelerationScheme(
|
---|
308 | DeviceIntPtr /*dev*/,
|
---|
309 | int /*scheme*/);
|
---|
310 |
|
---|
311 | extern _X_EXPORT Bool InitAbsoluteClassDeviceStruct(
|
---|
312 | DeviceIntPtr /*device*/);
|
---|
313 |
|
---|
314 | extern _X_EXPORT Bool InitFocusClassDeviceStruct(
|
---|
315 | DeviceIntPtr /*device*/);
|
---|
316 |
|
---|
317 | typedef void (*BellProcPtr)(
|
---|
318 | int /*percent*/,
|
---|
319 | DeviceIntPtr /*device*/,
|
---|
320 | pointer /*ctrl*/,
|
---|
321 | int);
|
---|
322 |
|
---|
323 | typedef void (*KbdCtrlProcPtr)(
|
---|
324 | DeviceIntPtr /*device*/,
|
---|
325 | KeybdCtrl * /*ctrl*/);
|
---|
326 |
|
---|
327 | typedef void (*PtrCtrlProcPtr)(
|
---|
328 | DeviceIntPtr /*device*/,
|
---|
329 | PtrCtrl * /*ctrl*/);
|
---|
330 |
|
---|
331 | extern _X_EXPORT Bool InitPtrFeedbackClassDeviceStruct(
|
---|
332 | DeviceIntPtr /*device*/,
|
---|
333 | PtrCtrlProcPtr /*controlProc*/);
|
---|
334 |
|
---|
335 | typedef void (*StringCtrlProcPtr)(
|
---|
336 | DeviceIntPtr /*device*/,
|
---|
337 | StringCtrl * /*ctrl*/);
|
---|
338 |
|
---|
339 | extern _X_EXPORT Bool InitStringFeedbackClassDeviceStruct(
|
---|
340 | DeviceIntPtr /*device*/,
|
---|
341 | StringCtrlProcPtr /*controlProc*/,
|
---|
342 | int /*max_symbols*/,
|
---|
343 | int /*num_symbols_supported*/,
|
---|
344 | KeySym* /*symbols*/);
|
---|
345 |
|
---|
346 | typedef void (*BellCtrlProcPtr)(
|
---|
347 | DeviceIntPtr /*device*/,
|
---|
348 | BellCtrl * /*ctrl*/);
|
---|
349 |
|
---|
350 | extern _X_EXPORT Bool InitBellFeedbackClassDeviceStruct(
|
---|
351 | DeviceIntPtr /*device*/,
|
---|
352 | BellProcPtr /*bellProc*/,
|
---|
353 | BellCtrlProcPtr /*controlProc*/);
|
---|
354 |
|
---|
355 | typedef void (*LedCtrlProcPtr)(
|
---|
356 | DeviceIntPtr /*device*/,
|
---|
357 | LedCtrl * /*ctrl*/);
|
---|
358 |
|
---|
359 | extern _X_EXPORT Bool InitLedFeedbackClassDeviceStruct(
|
---|
360 | DeviceIntPtr /*device*/,
|
---|
361 | LedCtrlProcPtr /*controlProc*/);
|
---|
362 |
|
---|
363 | typedef void (*IntegerCtrlProcPtr)(
|
---|
364 | DeviceIntPtr /*device*/,
|
---|
365 | IntegerCtrl * /*ctrl*/);
|
---|
366 |
|
---|
367 |
|
---|
368 | extern _X_EXPORT Bool InitIntegerFeedbackClassDeviceStruct(
|
---|
369 | DeviceIntPtr /*device*/,
|
---|
370 | IntegerCtrlProcPtr /*controlProc*/);
|
---|
371 |
|
---|
372 | extern _X_EXPORT Bool InitPointerDeviceStruct(
|
---|
373 | DevicePtr /*device*/,
|
---|
374 | CARD8* /*map*/,
|
---|
375 | int /*numButtons*/,
|
---|
376 | Atom* /* btn_labels */,
|
---|
377 | PtrCtrlProcPtr /*controlProc*/,
|
---|
378 | int /*numMotionEvents*/,
|
---|
379 | int /*numAxes*/,
|
---|
380 | Atom* /* axes_labels */);
|
---|
381 |
|
---|
382 | extern _X_EXPORT Bool InitKeyboardDeviceStruct(
|
---|
383 | DeviceIntPtr /*device*/,
|
---|
384 | XkbRMLVOSet * /*rmlvo*/,
|
---|
385 | BellProcPtr /*bellProc*/,
|
---|
386 | KbdCtrlProcPtr /*controlProc*/);
|
---|
387 |
|
---|
388 | extern int ApplyPointerMapping(
|
---|
389 | DeviceIntPtr /* pDev */,
|
---|
390 | CARD8 * /* map */,
|
---|
391 | int /* len */,
|
---|
392 | ClientPtr /* client */);
|
---|
393 |
|
---|
394 | extern Bool BadDeviceMap(
|
---|
395 | BYTE* /*buff*/,
|
---|
396 | int /*length*/,
|
---|
397 | unsigned /*low*/,
|
---|
398 | unsigned /*high*/,
|
---|
399 | XID* /*errval*/);
|
---|
400 |
|
---|
401 | extern void NoteLedState(
|
---|
402 | DeviceIntPtr /*keybd*/,
|
---|
403 | int /*led*/,
|
---|
404 | Bool /*on*/);
|
---|
405 |
|
---|
406 | extern void MaybeStopHint(
|
---|
407 | DeviceIntPtr /*device*/,
|
---|
408 | ClientPtr /*client*/);
|
---|
409 |
|
---|
410 | extern void ProcessPointerEvent(
|
---|
411 | InternalEvent* /* ev */,
|
---|
412 | DeviceIntPtr /*mouse*/);
|
---|
413 |
|
---|
414 | extern void ProcessKeyboardEvent(
|
---|
415 | InternalEvent* /*ev*/,
|
---|
416 | DeviceIntPtr /*keybd*/);
|
---|
417 |
|
---|
418 | extern Bool LegalModifier(
|
---|
419 | unsigned int /*key*/,
|
---|
420 | DeviceIntPtr /*pDev*/);
|
---|
421 |
|
---|
422 | extern _X_EXPORT void ProcessInputEvents(void);
|
---|
423 |
|
---|
424 | extern _X_EXPORT void InitInput(
|
---|
425 | int /*argc*/,
|
---|
426 | char ** /*argv*/);
|
---|
427 | extern _X_EXPORT void CloseInput(void);
|
---|
428 |
|
---|
429 | extern _X_EXPORT int GetMaximumEventsNum(void);
|
---|
430 |
|
---|
431 | extern _X_EXPORT int GetEventList(EventListPtr* list);
|
---|
432 | extern _X_EXPORT EventListPtr InitEventList(int num_events);
|
---|
433 | extern _X_EXPORT void FreeEventList(EventListPtr list, int num_events);
|
---|
434 |
|
---|
435 | extern void CreateClassesChangedEvent(EventListPtr event,
|
---|
436 | DeviceIntPtr master,
|
---|
437 | DeviceIntPtr slave,
|
---|
438 | int type);
|
---|
439 | extern EventListPtr UpdateFromMaster(
|
---|
440 | EventListPtr events,
|
---|
441 | DeviceIntPtr pDev,
|
---|
442 | int type,
|
---|
443 | int *num_events);
|
---|
444 |
|
---|
445 | extern _X_EXPORT int GetPointerEvents(
|
---|
446 | EventListPtr events,
|
---|
447 | DeviceIntPtr pDev,
|
---|
448 | int type,
|
---|
449 | int buttons,
|
---|
450 | int flags,
|
---|
451 | const ValuatorMask *mask);
|
---|
452 |
|
---|
453 | extern _X_EXPORT int GetKeyboardEvents(
|
---|
454 | EventListPtr events,
|
---|
455 | DeviceIntPtr pDev,
|
---|
456 | int type,
|
---|
457 | int key_code);
|
---|
458 |
|
---|
459 | extern int GetKeyboardValuatorEvents(
|
---|
460 | EventListPtr events,
|
---|
461 | DeviceIntPtr pDev,
|
---|
462 | int type,
|
---|
463 | int key_code,
|
---|
464 | const ValuatorMask *mask);
|
---|
465 |
|
---|
466 | extern int GetProximityEvents(
|
---|
467 | EventListPtr events,
|
---|
468 | DeviceIntPtr pDev,
|
---|
469 | int type,
|
---|
470 | const ValuatorMask *mask);
|
---|
471 |
|
---|
472 | extern void PostSyntheticMotion(
|
---|
473 | DeviceIntPtr pDev,
|
---|
474 | int x,
|
---|
475 | int y,
|
---|
476 | int screen,
|
---|
477 | unsigned long time);
|
---|
478 |
|
---|
479 | extern _X_EXPORT int GetMotionHistorySize(
|
---|
480 | void);
|
---|
481 |
|
---|
482 | extern _X_EXPORT void AllocateMotionHistory(
|
---|
483 | DeviceIntPtr pDev);
|
---|
484 |
|
---|
485 | extern _X_EXPORT int GetMotionHistory(
|
---|
486 | DeviceIntPtr pDev,
|
---|
487 | xTimecoord **buff,
|
---|
488 | unsigned long start,
|
---|
489 | unsigned long stop,
|
---|
490 | ScreenPtr pScreen,
|
---|
491 | BOOL core);
|
---|
492 |
|
---|
493 | extern int AttachDevice(ClientPtr client,
|
---|
494 | DeviceIntPtr slave,
|
---|
495 | DeviceIntPtr master);
|
---|
496 |
|
---|
497 | extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd);
|
---|
498 | extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type);
|
---|
499 |
|
---|
500 | extern _X_EXPORT int AllocDevicePair(ClientPtr client,
|
---|
501 | char* name,
|
---|
502 | DeviceIntPtr* ptr,
|
---|
503 | DeviceIntPtr* keybd,
|
---|
504 | DeviceProc ptr_proc,
|
---|
505 | DeviceProc keybd_proc,
|
---|
506 | Bool master);
|
---|
507 | extern void DeepCopyDeviceClasses(DeviceIntPtr from,
|
---|
508 | DeviceIntPtr to,
|
---|
509 | DeviceChangedEvent *dce);
|
---|
510 |
|
---|
511 | /* Helper functions. */
|
---|
512 | extern _X_EXPORT int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
|
---|
513 | KeyCode **modkeymap, int *max_keys_per_mod);
|
---|
514 | extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map,
|
---|
515 | int max_keys_per_mod);
|
---|
516 | extern int AllocXTestDevice(ClientPtr client,
|
---|
517 | char* name,
|
---|
518 | DeviceIntPtr* ptr,
|
---|
519 | DeviceIntPtr* keybd,
|
---|
520 | DeviceIntPtr master_ptr,
|
---|
521 | DeviceIntPtr master_keybd);
|
---|
522 | extern BOOL IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master);
|
---|
523 | extern DeviceIntPtr GetXTestDevice(DeviceIntPtr master);
|
---|
524 | extern void SendDevicePresenceEvent(int deviceid, int type);
|
---|
525 | extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes *attrs);
|
---|
526 | extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs);
|
---|
527 |
|
---|
528 | /* misc event helpers */
|
---|
529 | extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients);
|
---|
530 | extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event);
|
---|
531 | extern Mask GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev);
|
---|
532 | void FixUpEventFromWindow(SpritePtr pSprite,
|
---|
533 | xEvent *xE,
|
---|
534 | WindowPtr pWin,
|
---|
535 | Window child,
|
---|
536 | Bool calcChild);
|
---|
537 | extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
|
---|
538 | extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event,
|
---|
539 | WindowPtr win);
|
---|
540 | /**
|
---|
541 | * Return masks for EventIsDeliverable.
|
---|
542 | * @defgroup EventIsDeliverable return flags
|
---|
543 | * @{
|
---|
544 | */
|
---|
545 | #define XI_MASK (1 << 0) /**< XI mask set on window */
|
---|
546 | #define CORE_MASK (1 << 1) /**< Core mask set on window */
|
---|
547 | #define DONT_PROPAGATE_MASK (1 << 2) /**< DontPropagate mask set on window */
|
---|
548 | #define XI2_MASK (1 << 3) /**< XI2 mask set on window */
|
---|
549 | /* @} */
|
---|
550 |
|
---|
551 | /* Implemented by the DDX. */
|
---|
552 | extern _X_EXPORT int NewInputDeviceRequest(
|
---|
553 | InputOption *options,
|
---|
554 | InputAttributes *attrs,
|
---|
555 | DeviceIntPtr *dev);
|
---|
556 | extern _X_EXPORT void DeleteInputDeviceRequest(
|
---|
557 | DeviceIntPtr dev);
|
---|
558 |
|
---|
559 | extern _X_EXPORT void DDXRingBell(
|
---|
560 | int volume,
|
---|
561 | int pitch,
|
---|
562 | int duration);
|
---|
563 |
|
---|
564 | #define VALUATOR_MODE_ALL_AXES -1
|
---|
565 | extern _X_HIDDEN int valuator_get_mode(DeviceIntPtr dev, int axis);
|
---|
566 | extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode);
|
---|
567 |
|
---|
568 | /* Set to TRUE by default - os/utils.c sets it to FALSE on user request,
|
---|
569 | xfixes/cursor.c uses it to determine if the cursor is enabled */
|
---|
570 | extern Bool EnableCursor;
|
---|
571 |
|
---|
572 | extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators);
|
---|
573 | extern _X_EXPORT void valuator_mask_free(ValuatorMask **mask);
|
---|
574 | extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask,
|
---|
575 | int first_valuator, int num_valuators,
|
---|
576 | const int* valuators);
|
---|
577 | extern _X_EXPORT void valuator_mask_set(ValuatorMask *mask,
|
---|
578 | int valuator,
|
---|
579 | int data);
|
---|
580 | extern _X_EXPORT void valuator_mask_zero(ValuatorMask *mask);
|
---|
581 | extern _X_EXPORT int valuator_mask_size(const ValuatorMask *mask);
|
---|
582 | extern _X_EXPORT int valuator_mask_isset(const ValuatorMask *mask, int bit);
|
---|
583 | extern _X_EXPORT void valuator_mask_unset(ValuatorMask *mask, int bit);
|
---|
584 | extern _X_EXPORT int valuator_mask_num_valuators(const ValuatorMask *mask);
|
---|
585 | extern _X_EXPORT void valuator_mask_copy(ValuatorMask *dest,
|
---|
586 | const ValuatorMask *src);
|
---|
587 | extern _X_EXPORT int valuator_mask_get(const ValuatorMask *mask, int valnum);
|
---|
588 |
|
---|
589 | #endif /* INPUT_H */
|
---|