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 | #include "list.h"
|
---|
60 | #include <X11/extensions/XI2.h>
|
---|
61 |
|
---|
62 | #define DEVICE_INIT 0
|
---|
63 | #define DEVICE_ON 1
|
---|
64 | #define DEVICE_OFF 2
|
---|
65 | #define DEVICE_CLOSE 3
|
---|
66 |
|
---|
67 | #define POINTER_RELATIVE (1 << 1)
|
---|
68 | #define POINTER_ABSOLUTE (1 << 2)
|
---|
69 | #define POINTER_ACCELERATE (1 << 3)
|
---|
70 | #define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */
|
---|
71 | #define POINTER_NORAW (1 << 5) /* Don't generate RawEvents */
|
---|
72 | #define POINTER_EMULATED (1 << 6) /* Event was emulated from another event */
|
---|
73 |
|
---|
74 | /* GetTouchEvent flags */
|
---|
75 | #define TOUCH_ACCEPT (1 << 0)
|
---|
76 | #define TOUCH_REJECT (1 << 1)
|
---|
77 | #define TOUCH_PENDING_END (1 << 2)
|
---|
78 | #define TOUCH_CLIENT_ID (1 << 3) /* touch ID is the client-visible id */
|
---|
79 | #define TOUCH_REPLAYING (1 << 4) /* event is being replayed */
|
---|
80 | #define TOUCH_POINTER_EMULATED (1 << 5) /* touch event may be pointer emulated */
|
---|
81 | #define TOUCH_END (1 << 6) /* really end this touch now */
|
---|
82 |
|
---|
83 | /*int constants for pointer acceleration schemes*/
|
---|
84 | #define PtrAccelNoOp 0
|
---|
85 | #define PtrAccelPredictable 1
|
---|
86 | #define PtrAccelLightweight 2
|
---|
87 | #define PtrAccelDefault PtrAccelPredictable
|
---|
88 |
|
---|
89 | #define MAX_VALUATORS 36
|
---|
90 | /* Maximum number of valuators, divided by six, rounded up, to get number
|
---|
91 | * of events. */
|
---|
92 | #define MAX_VALUATOR_EVENTS 6
|
---|
93 | #define MAX_BUTTONS 256 /* completely arbitrarily chosen */
|
---|
94 |
|
---|
95 | #define NO_AXIS_LIMITS -1
|
---|
96 |
|
---|
97 | #define MAP_LENGTH 256
|
---|
98 | #define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */
|
---|
99 | #define NullGrab ((GrabPtr)NULL)
|
---|
100 | #define PointerRootWin ((WindowPtr)PointerRoot)
|
---|
101 | #define NoneWin ((WindowPtr)None)
|
---|
102 | #define NullDevice ((DevicePtr)NULL)
|
---|
103 |
|
---|
104 | #ifndef FollowKeyboard
|
---|
105 | #define FollowKeyboard 3
|
---|
106 | #endif
|
---|
107 | #ifndef FollowKeyboardWin
|
---|
108 | #define FollowKeyboardWin ((WindowPtr) FollowKeyboard)
|
---|
109 | #endif
|
---|
110 | #ifndef RevertToFollowKeyboard
|
---|
111 | #define RevertToFollowKeyboard 3
|
---|
112 | #endif
|
---|
113 |
|
---|
114 | enum InputLevel {
|
---|
115 | CORE,
|
---|
116 | XI,
|
---|
117 | XI2,
|
---|
118 | };
|
---|
119 |
|
---|
120 | typedef unsigned long Leds;
|
---|
121 | typedef struct _OtherClients *OtherClientsPtr;
|
---|
122 | typedef struct _InputClients *InputClientsPtr;
|
---|
123 | typedef struct _DeviceIntRec *DeviceIntPtr;
|
---|
124 | typedef struct _ValuatorClassRec *ValuatorClassPtr;
|
---|
125 | typedef struct _ClassesRec *ClassesPtr;
|
---|
126 | typedef struct _SpriteRec *SpritePtr;
|
---|
127 | typedef struct _TouchClassRec *TouchClassPtr;
|
---|
128 | typedef struct _TouchPointInfo *TouchPointInfoPtr;
|
---|
129 | typedef struct _DDXTouchPointInfo *DDXTouchPointInfoPtr;
|
---|
130 | typedef union _GrabMask GrabMask;
|
---|
131 |
|
---|
132 | typedef struct _ValuatorMask ValuatorMask;
|
---|
133 |
|
---|
134 | /* The DIX stores incoming input events in this list */
|
---|
135 | extern InternalEvent* InputEventList;
|
---|
136 |
|
---|
137 | typedef int (*DeviceProc)(
|
---|
138 | DeviceIntPtr /*device*/,
|
---|
139 | int /*what*/);
|
---|
140 |
|
---|
141 | typedef void (*ProcessInputProc)(
|
---|
142 | InternalEvent * /*event*/,
|
---|
143 | DeviceIntPtr /*device*/);
|
---|
144 |
|
---|
145 | typedef Bool (*DeviceHandleProc)(
|
---|
146 | DeviceIntPtr /*device*/,
|
---|
147 | void* /*data*/
|
---|
148 | );
|
---|
149 |
|
---|
150 | typedef void (*DeviceUnwrapProc)(
|
---|
151 | DeviceIntPtr /*device*/,
|
---|
152 | DeviceHandleProc /*proc*/,
|
---|
153 | void* /*data*/
|
---|
154 | );
|
---|
155 |
|
---|
156 | /* pointer acceleration handling */
|
---|
157 | typedef void (*PointerAccelSchemeProc)(
|
---|
158 | DeviceIntPtr /*device*/,
|
---|
159 | ValuatorMask* /*valuators*/,
|
---|
160 | CARD32 /*evtime*/);
|
---|
161 |
|
---|
162 | typedef void (*DeviceCallbackProc)(
|
---|
163 | DeviceIntPtr /*pDev*/);
|
---|
164 |
|
---|
165 | struct _ValuatorAccelerationRec;
|
---|
166 | typedef Bool (*PointerAccelSchemeInitProc)(
|
---|
167 | DeviceIntPtr /*dev*/,
|
---|
168 | struct _ValuatorAccelerationRec* /*protoScheme*/);
|
---|
169 |
|
---|
170 | typedef struct _DeviceRec {
|
---|
171 | pointer devicePrivate;
|
---|
172 | ProcessInputProc processInputProc; /* current */
|
---|
173 | ProcessInputProc realInputProc; /* deliver */
|
---|
174 | ProcessInputProc enqueueInputProc; /* enqueue */
|
---|
175 | Bool on; /* used by DDX to keep state */
|
---|
176 | } DeviceRec, *DevicePtr;
|
---|
177 |
|
---|
178 | typedef struct {
|
---|
179 | int click, bell, bell_pitch, bell_duration;
|
---|
180 | Bool autoRepeat;
|
---|
181 | unsigned char autoRepeats[32];
|
---|
182 | Leds leds;
|
---|
183 | unsigned char id;
|
---|
184 | } KeybdCtrl;
|
---|
185 |
|
---|
186 | typedef struct {
|
---|
187 | KeySym *map;
|
---|
188 | KeyCode minKeyCode,
|
---|
189 | maxKeyCode;
|
---|
190 | int mapWidth;
|
---|
191 | } KeySymsRec, *KeySymsPtr;
|
---|
192 |
|
---|
193 | typedef struct {
|
---|
194 | int num, den, threshold;
|
---|
195 | unsigned char id;
|
---|
196 | } PtrCtrl;
|
---|
197 |
|
---|
198 | typedef struct {
|
---|
199 | int resolution, min_value, max_value;
|
---|
200 | int integer_displayed;
|
---|
201 | unsigned char id;
|
---|
202 | } IntegerCtrl;
|
---|
203 |
|
---|
204 | typedef struct {
|
---|
205 | int max_symbols, num_symbols_supported;
|
---|
206 | int num_symbols_displayed;
|
---|
207 | KeySym *symbols_supported;
|
---|
208 | KeySym *symbols_displayed;
|
---|
209 | unsigned char id;
|
---|
210 | } StringCtrl;
|
---|
211 |
|
---|
212 | typedef struct {
|
---|
213 | int percent, pitch, duration;
|
---|
214 | unsigned char id;
|
---|
215 | } BellCtrl;
|
---|
216 |
|
---|
217 | typedef struct {
|
---|
218 | Leds led_values;
|
---|
219 | Mask led_mask;
|
---|
220 | unsigned char id;
|
---|
221 | } LedCtrl;
|
---|
222 |
|
---|
223 | extern _X_EXPORT KeybdCtrl defaultKeyboardControl;
|
---|
224 | extern _X_EXPORT PtrCtrl defaultPointerControl;
|
---|
225 |
|
---|
226 | typedef struct _InputOption InputOption;
|
---|
227 | typedef struct _XI2Mask XI2Mask;
|
---|
228 |
|
---|
229 | typedef struct _InputAttributes {
|
---|
230 | char *product;
|
---|
231 | char *vendor;
|
---|
232 | char *device;
|
---|
233 | char *pnp_id;
|
---|
234 | char *usb_id;
|
---|
235 | char **tags; /* null-terminated */
|
---|
236 | uint32_t flags;
|
---|
237 | } InputAttributes;
|
---|
238 |
|
---|
239 | #define ATTR_KEYBOARD (1<<0)
|
---|
240 | #define ATTR_POINTER (1<<1)
|
---|
241 | #define ATTR_JOYSTICK (1<<2)
|
---|
242 | #define ATTR_TABLET (1<<3)
|
---|
243 | #define ATTR_TOUCHPAD (1<<4)
|
---|
244 | #define ATTR_TOUCHSCREEN (1<<5)
|
---|
245 |
|
---|
246 | /* Key/Button has been run through all input processing and events sent to clients. */
|
---|
247 | #define KEY_PROCESSED 1
|
---|
248 | #define BUTTON_PROCESSED 1
|
---|
249 | /* Key/Button has not been fully processed, no events have been sent. */
|
---|
250 | #define KEY_POSTED 2
|
---|
251 | #define BUTTON_POSTED 2
|
---|
252 |
|
---|
253 | extern void set_key_down(DeviceIntPtr pDev, int key_code, int type);
|
---|
254 | extern void set_key_up(DeviceIntPtr pDev, int key_code, int type);
|
---|
255 | extern int key_is_down(DeviceIntPtr pDev, int key_code, int type);
|
---|
256 | extern void set_button_down(DeviceIntPtr pDev, int button, int type);
|
---|
257 | extern void set_button_up(DeviceIntPtr pDev, int button, int type);
|
---|
258 | extern int button_is_down(DeviceIntPtr pDev, int button, int type);
|
---|
259 |
|
---|
260 | extern void InitCoreDevices(void);
|
---|
261 | extern void InitXTestDevices(void);
|
---|
262 |
|
---|
263 | extern _X_EXPORT DeviceIntPtr AddInputDevice(
|
---|
264 | ClientPtr /*client*/,
|
---|
265 | DeviceProc /*deviceProc*/,
|
---|
266 | Bool /*autoStart*/);
|
---|
267 |
|
---|
268 | extern _X_EXPORT Bool EnableDevice(
|
---|
269 | DeviceIntPtr /*device*/,
|
---|
270 | BOOL /* sendevent */);
|
---|
271 |
|
---|
272 | extern _X_EXPORT Bool ActivateDevice(
|
---|
273 | DeviceIntPtr /*device*/,
|
---|
274 | BOOL /* sendevent */);
|
---|
275 |
|
---|
276 | extern _X_EXPORT Bool DisableDevice(
|
---|
277 | DeviceIntPtr /*device*/,
|
---|
278 | BOOL /* sendevent */);
|
---|
279 |
|
---|
280 | extern int InitAndStartDevices(void);
|
---|
281 |
|
---|
282 | extern void CloseDownDevices(void);
|
---|
283 |
|
---|
284 | extern void UndisplayDevices(void);
|
---|
285 |
|
---|
286 | extern _X_EXPORT int RemoveDevice(
|
---|
287 | DeviceIntPtr /*dev*/,
|
---|
288 | BOOL /* sendevent */);
|
---|
289 |
|
---|
290 | extern _X_EXPORT int NumMotionEvents(void);
|
---|
291 |
|
---|
292 | extern _X_EXPORT int dixLookupDevice(
|
---|
293 | DeviceIntPtr * /* dev */,
|
---|
294 | int /* id */,
|
---|
295 | ClientPtr /* client */,
|
---|
296 | Mask /* access_mode */);
|
---|
297 |
|
---|
298 | extern _X_EXPORT void QueryMinMaxKeyCodes(
|
---|
299 | KeyCode* /*minCode*/,
|
---|
300 | KeyCode* /*maxCode*/);
|
---|
301 |
|
---|
302 | extern _X_EXPORT Bool SetKeySymsMap(
|
---|
303 | KeySymsPtr /*dst*/,
|
---|
304 | KeySymsPtr /*src*/);
|
---|
305 |
|
---|
306 | extern _X_EXPORT Bool InitButtonClassDeviceStruct(
|
---|
307 | DeviceIntPtr /*device*/,
|
---|
308 | int /*numButtons*/,
|
---|
309 | Atom* /* labels */,
|
---|
310 | CARD8* /*map*/);
|
---|
311 |
|
---|
312 | extern _X_INTERNAL ValuatorClassPtr AllocValuatorClass(
|
---|
313 | ValuatorClassPtr src,
|
---|
314 | int numAxes);
|
---|
315 |
|
---|
316 | extern _X_EXPORT Bool InitValuatorClassDeviceStruct(
|
---|
317 | DeviceIntPtr /*device*/,
|
---|
318 | int /*numAxes*/,
|
---|
319 | Atom* /* labels */,
|
---|
320 | int /*numMotionEvents*/,
|
---|
321 | int /*mode*/);
|
---|
322 |
|
---|
323 | extern _X_EXPORT Bool InitPointerAccelerationScheme(
|
---|
324 | DeviceIntPtr /*dev*/,
|
---|
325 | int /*scheme*/);
|
---|
326 |
|
---|
327 | extern _X_EXPORT Bool InitFocusClassDeviceStruct(
|
---|
328 | DeviceIntPtr /*device*/);
|
---|
329 |
|
---|
330 | extern _X_EXPORT Bool InitTouchClassDeviceStruct(
|
---|
331 | DeviceIntPtr /*device*/,
|
---|
332 | unsigned int /*max_touches*/,
|
---|
333 | unsigned int /*mode*/,
|
---|
334 | unsigned int /*numAxes*/);
|
---|
335 |
|
---|
336 | typedef void (*BellProcPtr)(
|
---|
337 | int /*percent*/,
|
---|
338 | DeviceIntPtr /*device*/,
|
---|
339 | pointer /*ctrl*/,
|
---|
340 | int);
|
---|
341 |
|
---|
342 | typedef void (*KbdCtrlProcPtr)(
|
---|
343 | DeviceIntPtr /*device*/,
|
---|
344 | KeybdCtrl * /*ctrl*/);
|
---|
345 |
|
---|
346 | typedef void (*PtrCtrlProcPtr)(
|
---|
347 | DeviceIntPtr /*device*/,
|
---|
348 | PtrCtrl * /*ctrl*/);
|
---|
349 |
|
---|
350 | extern _X_EXPORT Bool InitPtrFeedbackClassDeviceStruct(
|
---|
351 | DeviceIntPtr /*device*/,
|
---|
352 | PtrCtrlProcPtr /*controlProc*/);
|
---|
353 |
|
---|
354 | typedef void (*StringCtrlProcPtr)(
|
---|
355 | DeviceIntPtr /*device*/,
|
---|
356 | StringCtrl * /*ctrl*/);
|
---|
357 |
|
---|
358 | extern _X_EXPORT Bool InitStringFeedbackClassDeviceStruct(
|
---|
359 | DeviceIntPtr /*device*/,
|
---|
360 | StringCtrlProcPtr /*controlProc*/,
|
---|
361 | int /*max_symbols*/,
|
---|
362 | int /*num_symbols_supported*/,
|
---|
363 | KeySym* /*symbols*/);
|
---|
364 |
|
---|
365 | typedef void (*BellCtrlProcPtr)(
|
---|
366 | DeviceIntPtr /*device*/,
|
---|
367 | BellCtrl * /*ctrl*/);
|
---|
368 |
|
---|
369 | extern _X_EXPORT Bool InitBellFeedbackClassDeviceStruct(
|
---|
370 | DeviceIntPtr /*device*/,
|
---|
371 | BellProcPtr /*bellProc*/,
|
---|
372 | BellCtrlProcPtr /*controlProc*/);
|
---|
373 |
|
---|
374 | typedef void (*LedCtrlProcPtr)(
|
---|
375 | DeviceIntPtr /*device*/,
|
---|
376 | LedCtrl * /*ctrl*/);
|
---|
377 |
|
---|
378 | extern _X_EXPORT Bool InitLedFeedbackClassDeviceStruct(
|
---|
379 | DeviceIntPtr /*device*/,
|
---|
380 | LedCtrlProcPtr /*controlProc*/);
|
---|
381 |
|
---|
382 | typedef void (*IntegerCtrlProcPtr)(
|
---|
383 | DeviceIntPtr /*device*/,
|
---|
384 | IntegerCtrl * /*ctrl*/);
|
---|
385 |
|
---|
386 |
|
---|
387 | extern _X_EXPORT Bool InitIntegerFeedbackClassDeviceStruct(
|
---|
388 | DeviceIntPtr /*device*/,
|
---|
389 | IntegerCtrlProcPtr /*controlProc*/);
|
---|
390 |
|
---|
391 | extern _X_EXPORT Bool InitPointerDeviceStruct(
|
---|
392 | DevicePtr /*device*/,
|
---|
393 | CARD8* /*map*/,
|
---|
394 | int /*numButtons*/,
|
---|
395 | Atom* /* btn_labels */,
|
---|
396 | PtrCtrlProcPtr /*controlProc*/,
|
---|
397 | int /*numMotionEvents*/,
|
---|
398 | int /*numAxes*/,
|
---|
399 | Atom* /* axes_labels */);
|
---|
400 |
|
---|
401 | extern _X_EXPORT Bool InitKeyboardDeviceStruct(
|
---|
402 | DeviceIntPtr /*device*/,
|
---|
403 | XkbRMLVOSet * /*rmlvo*/,
|
---|
404 | BellProcPtr /*bellProc*/,
|
---|
405 | KbdCtrlProcPtr /*controlProc*/);
|
---|
406 |
|
---|
407 | extern int ApplyPointerMapping(
|
---|
408 | DeviceIntPtr /* pDev */,
|
---|
409 | CARD8 * /* map */,
|
---|
410 | int /* len */,
|
---|
411 | ClientPtr /* client */);
|
---|
412 |
|
---|
413 | extern Bool BadDeviceMap(
|
---|
414 | BYTE* /*buff*/,
|
---|
415 | int /*length*/,
|
---|
416 | unsigned /*low*/,
|
---|
417 | unsigned /*high*/,
|
---|
418 | XID* /*errval*/);
|
---|
419 |
|
---|
420 | extern void NoteLedState(
|
---|
421 | DeviceIntPtr /*keybd*/,
|
---|
422 | int /*led*/,
|
---|
423 | Bool /*on*/);
|
---|
424 |
|
---|
425 | extern void MaybeStopHint(
|
---|
426 | DeviceIntPtr /*device*/,
|
---|
427 | ClientPtr /*client*/);
|
---|
428 |
|
---|
429 | extern void ProcessPointerEvent(
|
---|
430 | InternalEvent* /* ev */,
|
---|
431 | DeviceIntPtr /*mouse*/);
|
---|
432 |
|
---|
433 | extern void ProcessKeyboardEvent(
|
---|
434 | InternalEvent* /*ev*/,
|
---|
435 | DeviceIntPtr /*keybd*/);
|
---|
436 |
|
---|
437 | extern Bool LegalModifier(
|
---|
438 | unsigned int /*key*/,
|
---|
439 | DeviceIntPtr /*pDev*/);
|
---|
440 |
|
---|
441 | extern _X_EXPORT void ProcessInputEvents(void);
|
---|
442 |
|
---|
443 | extern _X_EXPORT void InitInput(
|
---|
444 | int /*argc*/,
|
---|
445 | char ** /*argv*/);
|
---|
446 | extern _X_EXPORT void CloseInput(void);
|
---|
447 |
|
---|
448 | extern _X_EXPORT int GetMaximumEventsNum(void);
|
---|
449 |
|
---|
450 | extern _X_EXPORT InternalEvent *InitEventList(int num_events);
|
---|
451 | extern _X_EXPORT void FreeEventList(InternalEvent *list, int num_events);
|
---|
452 |
|
---|
453 | extern void CreateClassesChangedEvent(InternalEvent *event,
|
---|
454 | DeviceIntPtr master,
|
---|
455 | DeviceIntPtr slave,
|
---|
456 | int flags);
|
---|
457 |
|
---|
458 | extern InternalEvent * UpdateFromMaster(
|
---|
459 | InternalEvent *events,
|
---|
460 | DeviceIntPtr pDev,
|
---|
461 | int type,
|
---|
462 | int *num_events);
|
---|
463 |
|
---|
464 | extern _X_EXPORT int GetPointerEvents(
|
---|
465 | InternalEvent *events,
|
---|
466 | DeviceIntPtr pDev,
|
---|
467 | int type,
|
---|
468 | int buttons,
|
---|
469 | int flags,
|
---|
470 | const ValuatorMask *mask);
|
---|
471 |
|
---|
472 | extern _X_EXPORT void QueuePointerEvents(
|
---|
473 | DeviceIntPtr pDev,
|
---|
474 | int type,
|
---|
475 | int buttons,
|
---|
476 | int flags,
|
---|
477 | const ValuatorMask *mask);
|
---|
478 |
|
---|
479 | extern _X_EXPORT int GetKeyboardEvents(
|
---|
480 | InternalEvent *events,
|
---|
481 | DeviceIntPtr pDev,
|
---|
482 | int type,
|
---|
483 | int key_code,
|
---|
484 | const ValuatorMask *mask);
|
---|
485 |
|
---|
486 | extern _X_EXPORT void QueueKeyboardEvents(
|
---|
487 | DeviceIntPtr pDev,
|
---|
488 | int type,
|
---|
489 | int key_code,
|
---|
490 | const ValuatorMask *mask);
|
---|
491 |
|
---|
492 | extern int GetTouchEvents(
|
---|
493 | InternalEvent *events,
|
---|
494 | DeviceIntPtr pDev,
|
---|
495 | uint32_t ddx_touchid,
|
---|
496 | uint16_t type,
|
---|
497 | uint32_t flags,
|
---|
498 | const ValuatorMask *mask);
|
---|
499 |
|
---|
500 | void QueueTouchEvents(DeviceIntPtr device,
|
---|
501 | int type,
|
---|
502 | uint32_t ddx_touchid,
|
---|
503 | int flags,
|
---|
504 | const ValuatorMask *mask);
|
---|
505 |
|
---|
506 | extern int GetTouchOwnershipEvents(
|
---|
507 | InternalEvent *events,
|
---|
508 | DeviceIntPtr pDev,
|
---|
509 | TouchPointInfoPtr ti,
|
---|
510 | uint8_t mode,
|
---|
511 | XID resource,
|
---|
512 | uint32_t flags);
|
---|
513 |
|
---|
514 | extern _X_EXPORT int GetProximityEvents(
|
---|
515 | InternalEvent *events,
|
---|
516 | DeviceIntPtr pDev,
|
---|
517 | int type,
|
---|
518 | const ValuatorMask *mask);
|
---|
519 |
|
---|
520 | extern _X_EXPORT void QueueProximityEvents(
|
---|
521 | DeviceIntPtr pDev,
|
---|
522 | int type,
|
---|
523 | const ValuatorMask *mask);
|
---|
524 |
|
---|
525 | extern void PostSyntheticMotion(
|
---|
526 | DeviceIntPtr pDev,
|
---|
527 | int x,
|
---|
528 | int y,
|
---|
529 | int screen,
|
---|
530 | unsigned long time);
|
---|
531 |
|
---|
532 | extern _X_EXPORT int GetMotionHistorySize(
|
---|
533 | void);
|
---|
534 |
|
---|
535 | extern _X_EXPORT void AllocateMotionHistory(
|
---|
536 | DeviceIntPtr pDev);
|
---|
537 |
|
---|
538 | extern _X_EXPORT int GetMotionHistory(
|
---|
539 | DeviceIntPtr pDev,
|
---|
540 | xTimecoord **buff,
|
---|
541 | unsigned long start,
|
---|
542 | unsigned long stop,
|
---|
543 | ScreenPtr pScreen,
|
---|
544 | BOOL core);
|
---|
545 |
|
---|
546 | extern void ReleaseButtonsAndKeys(DeviceIntPtr dev);
|
---|
547 |
|
---|
548 | extern int AttachDevice(ClientPtr client,
|
---|
549 | DeviceIntPtr slave,
|
---|
550 | DeviceIntPtr master);
|
---|
551 |
|
---|
552 | extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd);
|
---|
553 | extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type);
|
---|
554 |
|
---|
555 | extern _X_EXPORT int AllocDevicePair(ClientPtr client,
|
---|
556 | const char* name,
|
---|
557 | DeviceIntPtr* ptr,
|
---|
558 | DeviceIntPtr* keybd,
|
---|
559 | DeviceProc ptr_proc,
|
---|
560 | DeviceProc keybd_proc,
|
---|
561 | Bool master);
|
---|
562 | extern void DeepCopyDeviceClasses(DeviceIntPtr from,
|
---|
563 | DeviceIntPtr to,
|
---|
564 | DeviceChangedEvent *dce);
|
---|
565 |
|
---|
566 | /* Helper functions. */
|
---|
567 | extern _X_EXPORT int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
|
---|
568 | KeyCode **modkeymap, int *max_keys_per_mod);
|
---|
569 | extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map,
|
---|
570 | int max_keys_per_mod);
|
---|
571 | extern int AllocXTestDevice(ClientPtr client,
|
---|
572 | const char* name,
|
---|
573 | DeviceIntPtr* ptr,
|
---|
574 | DeviceIntPtr* keybd,
|
---|
575 | DeviceIntPtr master_ptr,
|
---|
576 | DeviceIntPtr master_keybd);
|
---|
577 | extern BOOL IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master);
|
---|
578 | extern DeviceIntPtr GetXTestDevice(DeviceIntPtr master);
|
---|
579 | extern void SendDevicePresenceEvent(int deviceid, int type);
|
---|
580 | extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes *attrs);
|
---|
581 | extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs);
|
---|
582 |
|
---|
583 | enum TouchListenerState{
|
---|
584 | LISTENER_AWAITING_BEGIN = 0, /**< Waiting for a TouchBegin event */
|
---|
585 | LISTENER_AWAITING_OWNER, /**< Waiting for a TouchOwnership event */
|
---|
586 | LISTENER_EARLY_ACCEPT, /**< Waiting for ownership, has already
|
---|
587 | accepted */
|
---|
588 | LISTENER_IS_OWNER, /**< Is the current owner */
|
---|
589 | LISTENER_HAS_END, /**< Has already received the end event */
|
---|
590 | };
|
---|
591 |
|
---|
592 | enum TouchListenerType {
|
---|
593 | LISTENER_GRAB,
|
---|
594 | LISTENER_POINTER_GRAB,
|
---|
595 | LISTENER_REGULAR,
|
---|
596 | LISTENER_POINTER_REGULAR,
|
---|
597 | };
|
---|
598 |
|
---|
599 | extern void TouchInitDDXTouchPoint(DeviceIntPtr dev, DDXTouchPointInfoPtr ddxtouch);
|
---|
600 | extern DDXTouchPointInfoPtr TouchBeginDDXTouch(DeviceIntPtr dev, uint32_t ddx_id);
|
---|
601 | extern void TouchEndDDXTouch(DeviceIntPtr dev, DDXTouchPointInfoPtr ti);
|
---|
602 | extern DDXTouchPointInfoPtr TouchFindByDDXID(DeviceIntPtr dev,
|
---|
603 | uint32_t ddx_id,
|
---|
604 | Bool create);
|
---|
605 | extern Bool TouchInitTouchPoint(TouchClassPtr touch, ValuatorClassPtr v, int index);
|
---|
606 | extern void TouchFreeTouchPoint(DeviceIntPtr dev, int index);
|
---|
607 | extern TouchPointInfoPtr TouchBeginTouch(DeviceIntPtr dev, int sourceid,
|
---|
608 | uint32_t touchid, Bool emulate_pointer);
|
---|
609 | extern TouchPointInfoPtr TouchFindByClientID(DeviceIntPtr dev,
|
---|
610 | uint32_t client_id);
|
---|
611 | extern void TouchEndTouch(DeviceIntPtr dev, TouchPointInfoPtr ti);
|
---|
612 | extern Bool TouchEventHistoryAllocate(TouchPointInfoPtr ti);
|
---|
613 | extern void TouchEventHistoryFree(TouchPointInfoPtr ti);
|
---|
614 | extern void TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev);
|
---|
615 | extern void TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource);
|
---|
616 | extern Bool TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource);
|
---|
617 | extern void TouchAddListener(TouchPointInfoPtr ti, XID resource, enum InputLevel level,
|
---|
618 | enum TouchListenerType type, enum TouchListenerState state,
|
---|
619 | WindowPtr window);
|
---|
620 | extern Bool TouchRemoveListener(TouchPointInfoPtr ti, XID resource);
|
---|
621 | extern void TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev);
|
---|
622 | extern Bool TouchEnsureSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
|
---|
623 | InternalEvent *ev);
|
---|
624 | extern Bool TouchBuildDependentSpriteTrace(DeviceIntPtr dev, SpritePtr sprite);
|
---|
625 | extern int TouchConvertToPointerEvent(const InternalEvent *ev,
|
---|
626 | InternalEvent *motion, InternalEvent *button);
|
---|
627 | extern int TouchGetPointerEventType(const InternalEvent *ev);
|
---|
628 | extern void TouchRemovePointerGrab(DeviceIntPtr dev);
|
---|
629 | extern void TouchListenerGone(XID resource);
|
---|
630 | extern int TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
|
---|
631 | uint32_t touchid, Window grab_window, XID *error);
|
---|
632 |
|
---|
633 | /* misc event helpers */
|
---|
634 | extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients);
|
---|
635 | extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event);
|
---|
636 | extern Bool WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent* ev);
|
---|
637 | extern int GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type);
|
---|
638 | void FixUpEventFromWindow(SpritePtr pSprite,
|
---|
639 | xEvent *xE,
|
---|
640 | WindowPtr pWin,
|
---|
641 | Window child,
|
---|
642 | Bool calcChild);
|
---|
643 | extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
|
---|
644 | extern int EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win);
|
---|
645 | extern Bool ActivatePassiveGrab(DeviceIntPtr dev, GrabPtr grab,
|
---|
646 | InternalEvent *ev, InternalEvent *real_event);
|
---|
647 | /**
|
---|
648 | * Masks specifying the type of event to deliver for an InternalEvent; used
|
---|
649 | * by EventIsDeliverable.
|
---|
650 | * @defgroup EventIsDeliverable return flags
|
---|
651 | * @{
|
---|
652 | */
|
---|
653 | #define EVENT_XI1_MASK (1 << 0) /**< XI1.x event */
|
---|
654 | #define EVENT_CORE_MASK (1 << 1) /**< Core event */
|
---|
655 | #define EVENT_DONT_PROPAGATE_MASK (1 << 2) /**< DontPropagate mask set */
|
---|
656 | #define EVENT_XI2_MASK (1 << 3) /**< XI2 mask set on window */
|
---|
657 | /* @} */
|
---|
658 |
|
---|
659 | enum EventDeliveryState {
|
---|
660 | EVENT_DELIVERED, /**< Event has been delivered to a client */
|
---|
661 | EVENT_NOT_DELIVERED, /**< Event was not delivered to any client */
|
---|
662 | EVENT_SKIP, /**< Event can be discarded by the caller */
|
---|
663 | EVENT_REJECTED, /**< Event was rejected for delivery to the client */
|
---|
664 | };
|
---|
665 |
|
---|
666 | /* Implemented by the DDX. */
|
---|
667 | extern _X_EXPORT int NewInputDeviceRequest(
|
---|
668 | InputOption *options,
|
---|
669 | InputAttributes *attrs,
|
---|
670 | DeviceIntPtr *dev);
|
---|
671 | extern _X_EXPORT void DeleteInputDeviceRequest(
|
---|
672 | DeviceIntPtr dev);
|
---|
673 |
|
---|
674 | extern _X_EXPORT void DDXRingBell(
|
---|
675 | int volume,
|
---|
676 | int pitch,
|
---|
677 | int duration);
|
---|
678 |
|
---|
679 | #define VALUATOR_MODE_ALL_AXES -1
|
---|
680 | extern _X_HIDDEN int valuator_get_mode(DeviceIntPtr dev, int axis);
|
---|
681 | extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode);
|
---|
682 |
|
---|
683 | /* Set to TRUE by default - os/utils.c sets it to FALSE on user request,
|
---|
684 | xfixes/cursor.c uses it to determine if the cursor is enabled */
|
---|
685 | extern Bool EnableCursor;
|
---|
686 |
|
---|
687 | extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators);
|
---|
688 | extern _X_EXPORT void valuator_mask_free(ValuatorMask **mask);
|
---|
689 | extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask,
|
---|
690 | int first_valuator, int num_valuators,
|
---|
691 | const int* valuators);
|
---|
692 | extern _X_EXPORT void valuator_mask_set(ValuatorMask *mask,
|
---|
693 | int valuator,
|
---|
694 | int data);
|
---|
695 | extern _X_EXPORT void valuator_mask_set_double(ValuatorMask *mask,
|
---|
696 | int valuator,
|
---|
697 | double data);
|
---|
698 | extern _X_EXPORT void valuator_mask_zero(ValuatorMask *mask);
|
---|
699 | extern _X_EXPORT int valuator_mask_size(const ValuatorMask *mask);
|
---|
700 | extern _X_EXPORT int valuator_mask_isset(const ValuatorMask *mask, int bit);
|
---|
701 | extern _X_EXPORT void valuator_mask_unset(ValuatorMask *mask, int bit);
|
---|
702 | extern _X_EXPORT int valuator_mask_num_valuators(const ValuatorMask *mask);
|
---|
703 | extern _X_EXPORT void valuator_mask_copy(ValuatorMask *dest,
|
---|
704 | const ValuatorMask *src);
|
---|
705 | extern _X_EXPORT int valuator_mask_get(const ValuatorMask *mask, int valnum);
|
---|
706 | extern _X_EXPORT double valuator_mask_get_double(const ValuatorMask *mask,
|
---|
707 | int valnum);
|
---|
708 | extern _X_EXPORT Bool valuator_mask_fetch(const ValuatorMask *mask,
|
---|
709 | int valnum, int *val);
|
---|
710 | extern _X_EXPORT Bool valuator_mask_fetch_double(const ValuatorMask *mask,
|
---|
711 | int valnum, double *val);
|
---|
712 |
|
---|
713 | /* InputOption handling interface */
|
---|
714 | extern _X_EXPORT InputOption* input_option_new(InputOption *list, const char *key, const char *value);
|
---|
715 | extern _X_EXPORT void input_option_free_list(InputOption **opt);
|
---|
716 | extern _X_EXPORT InputOption* input_option_free_element(InputOption *opt, const char *key);
|
---|
717 | extern _X_EXPORT InputOption* input_option_find(InputOption *list, const char *key);
|
---|
718 | extern _X_EXPORT const char* input_option_get_key(const InputOption *opt);
|
---|
719 | extern _X_EXPORT const char* input_option_get_value(const InputOption *opt);
|
---|
720 | extern _X_EXPORT void input_option_set_key(InputOption *opt, const char* key);
|
---|
721 | extern _X_EXPORT void input_option_set_value(InputOption *opt, const char* value);
|
---|
722 |
|
---|
723 | extern _X_HIDDEN Bool point_on_screen(ScreenPtr pScreen, int x, int y);
|
---|
724 | extern _X_HIDDEN void update_desktop_dimensions(void);
|
---|
725 |
|
---|
726 | #endif /* INPUT_H */
|
---|