VirtualBox

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

Last change on this file since 62489 was 49174, checked in by vboxsync, 11 years ago

Additions/x11: replace header files for X.Org Server 1.6.0 with those for version 1.6.5 due to an ABI bump in-between.

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