VirtualBox

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

Last change on this file since 33983 was 32163, checked in by vboxsync, 14 years ago

Additions/x11/x11include: additional headers for building drivers for X.Org Server 1.9

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