VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.6.99-20090831/input.h@ 22658

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

export Xorg 1.6.99 headers to OSE

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