VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.11.0/input.h@ 71881

Last change on this file since 71881 was 38824, checked in by vboxsync, 13 years ago

Additions/x11: header files for building X.Org Server 1.11 modules

  • Property svn:eol-style set to native
File size: 18.0 KB
Line 
1/************************************************************
2
3Copyright 1987, 1998 The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25
26Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
27
28 All Rights Reserved
29
30Permission to use, copy, modify, and distribute this software and its
31documentation for any purpose and without fee is hereby granted,
32provided that the above copyright notice appear in all copies and that
33both that copyright notice and this permission notice appear in
34supporting documentation, and that the name of Digital not be
35used in advertising or publicity pertaining to distribution of the
36software without specific, written prior permission.
37
38DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44SOFTWARE.
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#define POINTER_NORAW (1 << 5) /* Don't generate RawEvents */
70
71/*int constants for pointer acceleration schemes*/
72#define PtrAccelNoOp 0
73#define PtrAccelPredictable 1
74#define PtrAccelLightweight 2
75#define PtrAccelDefault PtrAccelPredictable
76
77#define MAX_VALUATORS 36
78/* Maximum number of valuators, divided by six, rounded up, to get number
79 * of events. */
80#define MAX_VALUATOR_EVENTS 6
81#define MAX_BUTTONS 256 /* completely arbitrarily chosen */
82
83#define NO_AXIS_LIMITS -1
84
85#define MAP_LENGTH 256
86#define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */
87#define NullGrab ((GrabPtr)NULL)
88#define PointerRootWin ((WindowPtr)PointerRoot)
89#define NoneWin ((WindowPtr)None)
90#define NullDevice ((DevicePtr)NULL)
91
92#ifndef FollowKeyboard
93#define FollowKeyboard 3
94#endif
95#ifndef FollowKeyboardWin
96#define FollowKeyboardWin ((WindowPtr) FollowKeyboard)
97#endif
98#ifndef RevertToFollowKeyboard
99#define RevertToFollowKeyboard 3
100#endif
101
102typedef unsigned long Leds;
103typedef struct _OtherClients *OtherClientsPtr;
104typedef struct _InputClients *InputClientsPtr;
105typedef struct _DeviceIntRec *DeviceIntPtr;
106typedef struct _ValuatorClassRec *ValuatorClassPtr;
107typedef struct _ClassesRec *ClassesPtr;
108typedef struct _SpriteRec *SpritePtr;
109typedef union _GrabMask GrabMask;
110
111typedef struct _ValuatorMask ValuatorMask;
112
113/* The DIX stores incoming input events in this list */
114extern InternalEvent* InputEventList;
115
116typedef int (*DeviceProc)(
117 DeviceIntPtr /*device*/,
118 int /*what*/);
119
120typedef void (*ProcessInputProc)(
121 InternalEvent * /*event*/,
122 DeviceIntPtr /*device*/);
123
124typedef Bool (*DeviceHandleProc)(
125 DeviceIntPtr /*device*/,
126 void* /*data*/
127 );
128
129typedef void (*DeviceUnwrapProc)(
130 DeviceIntPtr /*device*/,
131 DeviceHandleProc /*proc*/,
132 void* /*data*/
133 );
134
135/* pointer acceleration handling */
136typedef void (*PointerAccelSchemeProc)(
137 DeviceIntPtr /*device*/,
138 ValuatorMask* /*valuators*/,
139 CARD32 /*evtime*/);
140
141typedef void (*DeviceCallbackProc)(
142 DeviceIntPtr /*pDev*/);
143
144struct _ValuatorAccelerationRec;
145typedef Bool (*PointerAccelSchemeInitProc)(
146 DeviceIntPtr /*dev*/,
147 struct _ValuatorAccelerationRec* /*protoScheme*/);
148
149typedef struct _DeviceRec {
150 pointer devicePrivate;
151 ProcessInputProc processInputProc; /* current */
152 ProcessInputProc realInputProc; /* deliver */
153 ProcessInputProc enqueueInputProc; /* enqueue */
154 Bool on; /* used by DDX to keep state */
155} DeviceRec, *DevicePtr;
156
157typedef struct {
158 int click, bell, bell_pitch, bell_duration;
159 Bool autoRepeat;
160 unsigned char autoRepeats[32];
161 Leds leds;
162 unsigned char id;
163} KeybdCtrl;
164
165typedef struct {
166 KeySym *map;
167 KeyCode minKeyCode,
168 maxKeyCode;
169 int mapWidth;
170} KeySymsRec, *KeySymsPtr;
171
172typedef struct {
173 int num, den, threshold;
174 unsigned char id;
175} PtrCtrl;
176
177typedef struct {
178 int resolution, min_value, max_value;
179 int integer_displayed;
180 unsigned char id;
181} IntegerCtrl;
182
183typedef struct {
184 int max_symbols, num_symbols_supported;
185 int num_symbols_displayed;
186 KeySym *symbols_supported;
187 KeySym *symbols_displayed;
188 unsigned char id;
189} StringCtrl;
190
191typedef struct {
192 int percent, pitch, duration;
193 unsigned char id;
194} BellCtrl;
195
196typedef struct {
197 Leds led_values;
198 Mask led_mask;
199 unsigned char id;
200} LedCtrl;
201
202extern _X_EXPORT KeybdCtrl defaultKeyboardControl;
203extern _X_EXPORT PtrCtrl defaultPointerControl;
204
205typedef struct _InputOption {
206 char *key;
207 char *value;
208 struct _InputOption *next;
209} InputOption;
210
211typedef struct _InputAttributes {
212 char *product;
213 char *vendor;
214 char *device;
215 char *pnp_id;
216 char *usb_id;
217 char **tags; /* null-terminated */
218 uint32_t flags;
219} InputAttributes;
220
221#define ATTR_KEYBOARD (1<<0)
222#define ATTR_POINTER (1<<1)
223#define ATTR_JOYSTICK (1<<2)
224#define ATTR_TABLET (1<<3)
225#define ATTR_TOUCHPAD (1<<4)
226#define ATTR_TOUCHSCREEN (1<<5)
227
228/* Key/Button has been run through all input processing and events sent to clients. */
229#define KEY_PROCESSED 1
230#define BUTTON_PROCESSED 1
231/* Key/Button has not been fully processed, no events have been sent. */
232#define KEY_POSTED 2
233#define BUTTON_POSTED 2
234
235extern void set_key_down(DeviceIntPtr pDev, int key_code, int type);
236extern void set_key_up(DeviceIntPtr pDev, int key_code, int type);
237extern int key_is_down(DeviceIntPtr pDev, int key_code, int type);
238extern void set_button_down(DeviceIntPtr pDev, int button, int type);
239extern void set_button_up(DeviceIntPtr pDev, int button, int type);
240extern int button_is_down(DeviceIntPtr pDev, int button, int type);
241
242extern void InitCoreDevices(void);
243extern void InitXTestDevices(void);
244
245extern _X_EXPORT DeviceIntPtr AddInputDevice(
246 ClientPtr /*client*/,
247 DeviceProc /*deviceProc*/,
248 Bool /*autoStart*/);
249
250extern _X_EXPORT Bool EnableDevice(
251 DeviceIntPtr /*device*/,
252 BOOL /* sendevent */);
253
254extern _X_EXPORT Bool ActivateDevice(
255 DeviceIntPtr /*device*/,
256 BOOL /* sendevent */);
257
258extern _X_EXPORT Bool DisableDevice(
259 DeviceIntPtr /*device*/,
260 BOOL /* sendevent */);
261
262extern int InitAndStartDevices(void);
263
264extern void CloseDownDevices(void);
265
266extern void UndisplayDevices(void);
267
268extern _X_EXPORT int RemoveDevice(
269 DeviceIntPtr /*dev*/,
270 BOOL /* sendevent */);
271
272extern _X_EXPORT int NumMotionEvents(void);
273
274extern _X_EXPORT int dixLookupDevice(
275 DeviceIntPtr * /* dev */,
276 int /* id */,
277 ClientPtr /* client */,
278 Mask /* access_mode */);
279
280extern _X_EXPORT void QueryMinMaxKeyCodes(
281 KeyCode* /*minCode*/,
282 KeyCode* /*maxCode*/);
283
284extern _X_EXPORT Bool SetKeySymsMap(
285 KeySymsPtr /*dst*/,
286 KeySymsPtr /*src*/);
287
288extern _X_EXPORT Bool InitButtonClassDeviceStruct(
289 DeviceIntPtr /*device*/,
290 int /*numButtons*/,
291 Atom* /* labels */,
292 CARD8* /*map*/);
293
294extern _X_INTERNAL ValuatorClassPtr AllocValuatorClass(
295 ValuatorClassPtr src,
296 int numAxes);
297
298extern _X_EXPORT Bool InitValuatorClassDeviceStruct(
299 DeviceIntPtr /*device*/,
300 int /*numAxes*/,
301 Atom* /* labels */,
302 int /*numMotionEvents*/,
303 int /*mode*/);
304
305extern _X_EXPORT Bool InitPointerAccelerationScheme(
306 DeviceIntPtr /*dev*/,
307 int /*scheme*/);
308
309extern _X_EXPORT Bool InitFocusClassDeviceStruct(
310 DeviceIntPtr /*device*/);
311
312typedef void (*BellProcPtr)(
313 int /*percent*/,
314 DeviceIntPtr /*device*/,
315 pointer /*ctrl*/,
316 int);
317
318typedef void (*KbdCtrlProcPtr)(
319 DeviceIntPtr /*device*/,
320 KeybdCtrl * /*ctrl*/);
321
322typedef void (*PtrCtrlProcPtr)(
323 DeviceIntPtr /*device*/,
324 PtrCtrl * /*ctrl*/);
325
326extern _X_EXPORT Bool InitPtrFeedbackClassDeviceStruct(
327 DeviceIntPtr /*device*/,
328 PtrCtrlProcPtr /*controlProc*/);
329
330typedef void (*StringCtrlProcPtr)(
331 DeviceIntPtr /*device*/,
332 StringCtrl * /*ctrl*/);
333
334extern _X_EXPORT Bool InitStringFeedbackClassDeviceStruct(
335 DeviceIntPtr /*device*/,
336 StringCtrlProcPtr /*controlProc*/,
337 int /*max_symbols*/,
338 int /*num_symbols_supported*/,
339 KeySym* /*symbols*/);
340
341typedef void (*BellCtrlProcPtr)(
342 DeviceIntPtr /*device*/,
343 BellCtrl * /*ctrl*/);
344
345extern _X_EXPORT Bool InitBellFeedbackClassDeviceStruct(
346 DeviceIntPtr /*device*/,
347 BellProcPtr /*bellProc*/,
348 BellCtrlProcPtr /*controlProc*/);
349
350typedef void (*LedCtrlProcPtr)(
351 DeviceIntPtr /*device*/,
352 LedCtrl * /*ctrl*/);
353
354extern _X_EXPORT Bool InitLedFeedbackClassDeviceStruct(
355 DeviceIntPtr /*device*/,
356 LedCtrlProcPtr /*controlProc*/);
357
358typedef void (*IntegerCtrlProcPtr)(
359 DeviceIntPtr /*device*/,
360 IntegerCtrl * /*ctrl*/);
361
362
363extern _X_EXPORT Bool InitIntegerFeedbackClassDeviceStruct(
364 DeviceIntPtr /*device*/,
365 IntegerCtrlProcPtr /*controlProc*/);
366
367extern _X_EXPORT Bool InitPointerDeviceStruct(
368 DevicePtr /*device*/,
369 CARD8* /*map*/,
370 int /*numButtons*/,
371 Atom* /* btn_labels */,
372 PtrCtrlProcPtr /*controlProc*/,
373 int /*numMotionEvents*/,
374 int /*numAxes*/,
375 Atom* /* axes_labels */);
376
377extern _X_EXPORT Bool InitKeyboardDeviceStruct(
378 DeviceIntPtr /*device*/,
379 XkbRMLVOSet * /*rmlvo*/,
380 BellProcPtr /*bellProc*/,
381 KbdCtrlProcPtr /*controlProc*/);
382
383extern int ApplyPointerMapping(
384 DeviceIntPtr /* pDev */,
385 CARD8 * /* map */,
386 int /* len */,
387 ClientPtr /* client */);
388
389extern Bool BadDeviceMap(
390 BYTE* /*buff*/,
391 int /*length*/,
392 unsigned /*low*/,
393 unsigned /*high*/,
394 XID* /*errval*/);
395
396extern void NoteLedState(
397 DeviceIntPtr /*keybd*/,
398 int /*led*/,
399 Bool /*on*/);
400
401extern void MaybeStopHint(
402 DeviceIntPtr /*device*/,
403 ClientPtr /*client*/);
404
405extern void ProcessPointerEvent(
406 InternalEvent* /* ev */,
407 DeviceIntPtr /*mouse*/);
408
409extern void ProcessKeyboardEvent(
410 InternalEvent* /*ev*/,
411 DeviceIntPtr /*keybd*/);
412
413extern Bool LegalModifier(
414 unsigned int /*key*/,
415 DeviceIntPtr /*pDev*/);
416
417extern _X_EXPORT void ProcessInputEvents(void);
418
419extern _X_EXPORT void InitInput(
420 int /*argc*/,
421 char ** /*argv*/);
422extern _X_EXPORT void CloseInput(void);
423
424extern _X_EXPORT int GetMaximumEventsNum(void);
425
426extern _X_EXPORT InternalEvent *InitEventList(int num_events);
427extern _X_EXPORT void FreeEventList(InternalEvent *list, int num_events);
428
429extern void CreateClassesChangedEvent(InternalEvent *event,
430 DeviceIntPtr master,
431 DeviceIntPtr slave,
432 int type);
433extern InternalEvent * UpdateFromMaster(
434 InternalEvent *events,
435 DeviceIntPtr pDev,
436 int type,
437 int *num_events);
438
439extern _X_EXPORT int GetPointerEvents(
440 InternalEvent *events,
441 DeviceIntPtr pDev,
442 int type,
443 int buttons,
444 int flags,
445 const ValuatorMask *mask);
446
447extern _X_EXPORT void QueuePointerEvents(
448 DeviceIntPtr pDev,
449 int type,
450 int buttons,
451 int flags,
452 const ValuatorMask *mask);
453
454extern _X_EXPORT int GetKeyboardEvents(
455 InternalEvent *events,
456 DeviceIntPtr pDev,
457 int type,
458 int key_code,
459 const ValuatorMask *mask);
460
461extern _X_EXPORT void QueueKeyboardEvents(
462 DeviceIntPtr pDev,
463 int type,
464 int key_code,
465 const ValuatorMask *mask);
466
467extern int GetProximityEvents(
468 InternalEvent *events,
469 DeviceIntPtr pDev,
470 int type,
471 const ValuatorMask *mask);
472
473extern void QueueProximityEvents(
474 DeviceIntPtr pDev,
475 int type,
476 const ValuatorMask *mask);
477
478extern void PostSyntheticMotion(
479 DeviceIntPtr pDev,
480 int x,
481 int y,
482 int screen,
483 unsigned long time);
484
485extern _X_EXPORT int GetMotionHistorySize(
486 void);
487
488extern _X_EXPORT void AllocateMotionHistory(
489 DeviceIntPtr pDev);
490
491extern _X_EXPORT int GetMotionHistory(
492 DeviceIntPtr pDev,
493 xTimecoord **buff,
494 unsigned long start,
495 unsigned long stop,
496 ScreenPtr pScreen,
497 BOOL core);
498
499extern void ReleaseButtonsAndKeys(DeviceIntPtr dev);
500
501extern int AttachDevice(ClientPtr client,
502 DeviceIntPtr slave,
503 DeviceIntPtr master);
504
505extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd);
506extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type);
507
508extern _X_EXPORT int AllocDevicePair(ClientPtr client,
509 char* name,
510 DeviceIntPtr* ptr,
511 DeviceIntPtr* keybd,
512 DeviceProc ptr_proc,
513 DeviceProc keybd_proc,
514 Bool master);
515extern void DeepCopyDeviceClasses(DeviceIntPtr from,
516 DeviceIntPtr to,
517 DeviceChangedEvent *dce);
518
519/* Helper functions. */
520extern _X_EXPORT int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
521 KeyCode **modkeymap, int *max_keys_per_mod);
522extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map,
523 int max_keys_per_mod);
524extern int AllocXTestDevice(ClientPtr client,
525 char* name,
526 DeviceIntPtr* ptr,
527 DeviceIntPtr* keybd,
528 DeviceIntPtr master_ptr,
529 DeviceIntPtr master_keybd);
530extern BOOL IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master);
531extern DeviceIntPtr GetXTestDevice(DeviceIntPtr master);
532extern void SendDevicePresenceEvent(int deviceid, int type);
533extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes *attrs);
534extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs);
535
536/* misc event helpers */
537extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients);
538extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event);
539extern Mask GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev);
540void FixUpEventFromWindow(SpritePtr pSprite,
541 xEvent *xE,
542 WindowPtr pWin,
543 Window child,
544 Bool calcChild);
545extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
546extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event,
547 WindowPtr win);
548/**
549 * Masks specifying the type of event to deliver for an InternalEvent; used
550 * by EventIsDeliverable.
551 * @defgroup EventIsDeliverable return flags
552 * @{
553 */
554#define EVENT_XI1_MASK (1 << 0) /**< XI1.x event */
555#define EVENT_CORE_MASK (1 << 1) /**< Core event */
556#define EVENT_DONT_PROPAGATE_MASK (1 << 2) /**< DontPropagate mask set */
557#define EVENT_XI2_MASK (1 << 3) /**< XI2 mask set on window */
558/* @} */
559
560/* Implemented by the DDX. */
561extern _X_EXPORT int NewInputDeviceRequest(
562 InputOption *options,
563 InputAttributes *attrs,
564 DeviceIntPtr *dev);
565extern _X_EXPORT void DeleteInputDeviceRequest(
566 DeviceIntPtr dev);
567
568extern _X_EXPORT void DDXRingBell(
569 int volume,
570 int pitch,
571 int duration);
572
573#define VALUATOR_MODE_ALL_AXES -1
574extern _X_HIDDEN int valuator_get_mode(DeviceIntPtr dev, int axis);
575extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode);
576
577/* Set to TRUE by default - os/utils.c sets it to FALSE on user request,
578 xfixes/cursor.c uses it to determine if the cursor is enabled */
579extern Bool EnableCursor;
580
581extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators);
582extern _X_EXPORT void valuator_mask_free(ValuatorMask **mask);
583extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask,
584 int first_valuator, int num_valuators,
585 const int* valuators);
586extern _X_EXPORT void valuator_mask_set(ValuatorMask *mask,
587 int valuator,
588 int data);
589extern _X_EXPORT void valuator_mask_zero(ValuatorMask *mask);
590extern _X_EXPORT int valuator_mask_size(const ValuatorMask *mask);
591extern _X_EXPORT int valuator_mask_isset(const ValuatorMask *mask, int bit);
592extern _X_EXPORT void valuator_mask_unset(ValuatorMask *mask, int bit);
593extern _X_EXPORT int valuator_mask_num_valuators(const ValuatorMask *mask);
594extern _X_EXPORT void valuator_mask_copy(ValuatorMask *dest,
595 const ValuatorMask *src);
596extern _X_EXPORT int valuator_mask_get(const ValuatorMask *mask, int valnum);
597
598#endif /* INPUT_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette