VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/1.6/xorg/input.h@ 17240

Last change on this file since 17240 was 17240, checked in by vboxsync, 16 years ago

Additions/x11/x11include: blast! Done it again. Reverted r43561.

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