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