VirtualBox

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

Last change on this file since 35462 was 28062, checked in by vboxsync, 15 years ago

Additions/x11/x11include: header files for building X.Org server 1.8 drivers

  • Property svn:eol-style set to native
File size: 15.5 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 **tags; /* null-terminated */
219 uint32_t flags;
220} InputAttributes;
221
222#define ATTR_KEYBOARD (1<<0)
223#define ATTR_POINTER (1<<1)
224#define ATTR_JOYSTICK (1<<2)
225#define ATTR_TABLET (1<<3)
226#define ATTR_TOUCHPAD (1<<4)
227#define ATTR_TOUCHSCREEN (1<<5)
228
229/* Key has been run through all input processing and events sent to clients. */
230#define KEY_PROCESSED 1
231/* Key has not been fully processed, no events have been sent. */
232#define KEY_POSTED 2
233
234extern void set_key_down(DeviceIntPtr pDev, int key_code, int type);
235extern void set_key_up(DeviceIntPtr pDev, int key_code, int type);
236extern int key_is_down(DeviceIntPtr pDev, int key_code, int type);
237
238extern void InitCoreDevices(void);
239extern void InitXTestDevices(void);
240
241extern _X_EXPORT DeviceIntPtr AddInputDevice(
242 ClientPtr /*client*/,
243 DeviceProc /*deviceProc*/,
244 Bool /*autoStart*/);
245
246extern _X_EXPORT Bool EnableDevice(
247 DeviceIntPtr /*device*/,
248 BOOL /* sendevent */);
249
250extern _X_EXPORT Bool ActivateDevice(
251 DeviceIntPtr /*device*/,
252 BOOL /* sendevent */);
253
254extern _X_EXPORT Bool DisableDevice(
255 DeviceIntPtr /*device*/,
256 BOOL /* sendevent */);
257
258extern int InitAndStartDevices(void);
259
260extern void CloseDownDevices(void);
261
262extern void UndisplayDevices(void);
263
264extern _X_EXPORT int RemoveDevice(
265 DeviceIntPtr /*dev*/,
266 BOOL /* sendevent */);
267
268extern _X_EXPORT int NumMotionEvents(void);
269
270extern void RegisterPointerDevice(
271 DeviceIntPtr /*device*/);
272
273extern void RegisterKeyboardDevice(
274 DeviceIntPtr /*device*/);
275
276extern _X_EXPORT int dixLookupDevice(
277 DeviceIntPtr * /* dev */,
278 int /* id */,
279 ClientPtr /* client */,
280 Mask /* access_mode */);
281
282extern _X_EXPORT void QueryMinMaxKeyCodes(
283 KeyCode* /*minCode*/,
284 KeyCode* /*maxCode*/);
285
286extern _X_EXPORT Bool SetKeySymsMap(
287 KeySymsPtr /*dst*/,
288 KeySymsPtr /*src*/);
289
290extern _X_EXPORT Bool InitButtonClassDeviceStruct(
291 DeviceIntPtr /*device*/,
292 int /*numButtons*/,
293 Atom* /* labels */,
294 CARD8* /*map*/);
295
296extern _X_EXPORT Bool InitValuatorClassDeviceStruct(
297 DeviceIntPtr /*device*/,
298 int /*numAxes*/,
299 Atom* /* labels */,
300 int /*numMotionEvents*/,
301 int /*mode*/);
302
303extern _X_EXPORT Bool InitPointerAccelerationScheme(
304 DeviceIntPtr /*dev*/,
305 int /*scheme*/);
306
307extern _X_EXPORT Bool InitAbsoluteClassDeviceStruct(
308 DeviceIntPtr /*device*/);
309
310extern _X_EXPORT Bool InitFocusClassDeviceStruct(
311 DeviceIntPtr /*device*/);
312
313typedef void (*BellProcPtr)(
314 int /*percent*/,
315 DeviceIntPtr /*device*/,
316 pointer /*ctrl*/,
317 int);
318
319typedef void (*KbdCtrlProcPtr)(
320 DeviceIntPtr /*device*/,
321 KeybdCtrl * /*ctrl*/);
322
323typedef void (*PtrCtrlProcPtr)(
324 DeviceIntPtr /*device*/,
325 PtrCtrl * /*ctrl*/);
326
327extern _X_EXPORT Bool InitPtrFeedbackClassDeviceStruct(
328 DeviceIntPtr /*device*/,
329 PtrCtrlProcPtr /*controlProc*/);
330
331typedef void (*StringCtrlProcPtr)(
332 DeviceIntPtr /*device*/,
333 StringCtrl * /*ctrl*/);
334
335extern _X_EXPORT Bool InitStringFeedbackClassDeviceStruct(
336 DeviceIntPtr /*device*/,
337 StringCtrlProcPtr /*controlProc*/,
338 int /*max_symbols*/,
339 int /*num_symbols_supported*/,
340 KeySym* /*symbols*/);
341
342typedef void (*BellCtrlProcPtr)(
343 DeviceIntPtr /*device*/,
344 BellCtrl * /*ctrl*/);
345
346extern _X_EXPORT Bool InitBellFeedbackClassDeviceStruct(
347 DeviceIntPtr /*device*/,
348 BellProcPtr /*bellProc*/,
349 BellCtrlProcPtr /*controlProc*/);
350
351typedef void (*LedCtrlProcPtr)(
352 DeviceIntPtr /*device*/,
353 LedCtrl * /*ctrl*/);
354
355extern _X_EXPORT Bool InitLedFeedbackClassDeviceStruct(
356 DeviceIntPtr /*device*/,
357 LedCtrlProcPtr /*controlProc*/);
358
359typedef void (*IntegerCtrlProcPtr)(
360 DeviceIntPtr /*device*/,
361 IntegerCtrl * /*ctrl*/);
362
363
364extern _X_EXPORT Bool InitIntegerFeedbackClassDeviceStruct(
365 DeviceIntPtr /*device*/,
366 IntegerCtrlProcPtr /*controlProc*/);
367
368extern _X_EXPORT Bool InitPointerDeviceStruct(
369 DevicePtr /*device*/,
370 CARD8* /*map*/,
371 int /*numButtons*/,
372 Atom* /* btn_labels */,
373 PtrCtrlProcPtr /*controlProc*/,
374 int /*numMotionEvents*/,
375 int /*numAxes*/,
376 Atom* /* axes_labels */);
377
378extern _X_EXPORT Bool InitKeyboardDeviceStruct(
379 DeviceIntPtr /*device*/,
380 XkbRMLVOSet * /*rmlvo*/,
381 BellProcPtr /*bellProc*/,
382 KbdCtrlProcPtr /*controlProc*/);
383
384extern int ApplyPointerMapping(
385 DeviceIntPtr /* pDev */,
386 CARD8 * /* map */,
387 int /* len */,
388 ClientPtr /* client */);
389
390extern Bool BadDeviceMap(
391 BYTE* /*buff*/,
392 int /*length*/,
393 unsigned /*low*/,
394 unsigned /*high*/,
395 XID* /*errval*/);
396
397extern void NoteLedState(
398 DeviceIntPtr /*keybd*/,
399 int /*led*/,
400 Bool /*on*/);
401
402extern void MaybeStopHint(
403 DeviceIntPtr /*device*/,
404 ClientPtr /*client*/);
405
406extern void ProcessPointerEvent(
407 InternalEvent* /* ev */,
408 DeviceIntPtr /*mouse*/);
409
410extern void ProcessKeyboardEvent(
411 InternalEvent* /*ev*/,
412 DeviceIntPtr /*keybd*/);
413
414extern Bool LegalModifier(
415 unsigned int /*key*/,
416 DeviceIntPtr /*pDev*/);
417
418extern _X_EXPORT void ProcessInputEvents(void);
419
420extern _X_EXPORT void InitInput(
421 int /*argc*/,
422 char ** /*argv*/);
423extern _X_EXPORT void CloseInput(void);
424
425extern _X_EXPORT int GetMaximumEventsNum(void);
426
427extern _X_EXPORT int GetEventList(EventListPtr* list);
428extern _X_EXPORT EventListPtr InitEventList(int num_events);
429extern _X_EXPORT void FreeEventList(EventListPtr list, int num_events);
430
431extern void CreateClassesChangedEvent(EventListPtr event,
432 DeviceIntPtr master,
433 DeviceIntPtr slave,
434 int type);
435extern int GetPointerEvents(
436 EventListPtr events,
437 DeviceIntPtr pDev,
438 int type,
439 int buttons,
440 int flags,
441 int first_valuator,
442 int num_valuators,
443 int *valuators);
444
445extern int GetKeyboardEvents(
446 EventListPtr events,
447 DeviceIntPtr pDev,
448 int type,
449 int key_code);
450
451extern int GetKeyboardValuatorEvents(
452 EventListPtr events,
453 DeviceIntPtr pDev,
454 int type,
455 int key_code,
456 int first_valuator,
457 int num_valuator,
458 int *valuators);
459
460extern int GetProximityEvents(
461 EventListPtr events,
462 DeviceIntPtr pDev,
463 int type,
464 int first_valuator,
465 int num_valuators,
466 int *valuators);
467
468extern void PostSyntheticMotion(
469 DeviceIntPtr pDev,
470 int x,
471 int y,
472 int screen,
473 unsigned long time);
474
475extern _X_EXPORT int GetMotionHistorySize(
476 void);
477
478extern _X_EXPORT void AllocateMotionHistory(
479 DeviceIntPtr pDev);
480
481extern _X_EXPORT int GetMotionHistory(
482 DeviceIntPtr pDev,
483 xTimecoord **buff,
484 unsigned long start,
485 unsigned long stop,
486 ScreenPtr pScreen,
487 BOOL core);
488
489extern int AttachDevice(ClientPtr client,
490 DeviceIntPtr slave,
491 DeviceIntPtr master);
492
493extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd);
494extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type);
495
496extern int AllocDevicePair(ClientPtr client,
497 char* name,
498 DeviceIntPtr* ptr,
499 DeviceIntPtr* keybd,
500 DeviceProc ptr_proc,
501 DeviceProc keybd_proc,
502 Bool master);
503extern void DeepCopyDeviceClasses(DeviceIntPtr from,
504 DeviceIntPtr to,
505 DeviceChangedEvent *dce);
506
507/* Helper functions. */
508extern int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
509 KeyCode **modkeymap, int *max_keys_per_mod);
510extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map,
511 int max_keys_per_mod);
512extern int AllocXTestDevice(ClientPtr client,
513 char* name,
514 DeviceIntPtr* ptr,
515 DeviceIntPtr* keybd,
516 DeviceIntPtr master_ptr,
517 DeviceIntPtr master_keybd);
518extern BOOL IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master);
519extern DeviceIntPtr GetXTestDevice(DeviceIntPtr master);
520extern void SendDevicePresenceEvent(int deviceid, int type);
521
522/* misc event helpers */
523extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event);
524extern Mask GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev);
525void FixUpEventFromWindow(DeviceIntPtr pDev,
526 xEvent *xE,
527 WindowPtr pWin,
528 Window child,
529 Bool calcChild);
530
531/* Implemented by the DDX. */
532extern _X_EXPORT int NewInputDeviceRequest(
533 InputOption *options,
534 InputAttributes *attrs,
535 DeviceIntPtr *dev);
536extern _X_EXPORT void DeleteInputDeviceRequest(
537 DeviceIntPtr dev);
538
539extern _X_EXPORT void DDXRingBell(
540 int volume,
541 int pitch,
542 int duration);
543
544/* Set to TRUE by default - os/utils.c sets it to FALSE on user request,
545 xfixes/cursor.c uses it to determine if the cursor is enabled */
546extern Bool EnableCursor;
547
548#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