VirtualBox

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

Last change on this file since 61522 was 43272, checked in by vboxsync, 12 years ago

Additions/x11: more original X server headers.

  • Property svn:eol-style set to native
File size: 15.1 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 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 FreeEventList(EventListPtr list, int num_events);
413
414extern void CreateClassesChangedEvent(EventListPtr event,
415 DeviceIntPtr master,
416 DeviceIntPtr slave,
417 int type);
418extern int GetPointerEvents(
419 EventListPtr events,
420 DeviceIntPtr pDev,
421 int type,
422 int buttons,
423 int flags,
424 int first_valuator,
425 int num_valuators,
426 int *valuators);
427
428extern int GetKeyboardEvents(
429 EventListPtr events,
430 DeviceIntPtr pDev,
431 int type,
432 int key_code);
433
434extern int GetKeyboardValuatorEvents(
435 EventListPtr events,
436 DeviceIntPtr pDev,
437 int type,
438 int key_code,
439 int first_valuator,
440 int num_valuator,
441 int *valuators);
442
443extern int GetProximityEvents(
444 EventListPtr events,
445 DeviceIntPtr pDev,
446 int type,
447 int first_valuator,
448 int num_valuators,
449 int *valuators);
450
451extern void PostSyntheticMotion(
452 DeviceIntPtr pDev,
453 int x,
454 int y,
455 int screen,
456 unsigned long time);
457
458extern _X_EXPORT int GetMotionHistorySize(
459 void);
460
461extern _X_EXPORT void AllocateMotionHistory(
462 DeviceIntPtr pDev);
463
464extern _X_EXPORT int GetMotionHistory(
465 DeviceIntPtr pDev,
466 xTimecoord **buff,
467 unsigned long start,
468 unsigned long stop,
469 ScreenPtr pScreen,
470 BOOL core);
471
472extern int AttachDevice(ClientPtr client,
473 DeviceIntPtr slave,
474 DeviceIntPtr master);
475
476extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd);
477extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type);
478
479extern int AllocDevicePair(ClientPtr client,
480 char* name,
481 DeviceIntPtr* ptr,
482 DeviceIntPtr* keybd,
483 DeviceProc ptr_proc,
484 DeviceProc keybd_proc,
485 Bool master);
486extern void DeepCopyDeviceClasses(DeviceIntPtr from,
487 DeviceIntPtr to,
488 DeviceChangedEvent *dce);
489
490/* Helper functions. */
491extern int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
492 KeyCode **modkeymap, int *max_keys_per_mod);
493extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map,
494 int max_keys_per_mod);
495extern int AllocXTestDevice(ClientPtr client,
496 char* name,
497 DeviceIntPtr* ptr,
498 DeviceIntPtr* keybd,
499 DeviceIntPtr master_ptr,
500 DeviceIntPtr master_keybd);
501extern BOOL IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master);
502extern DeviceIntPtr GetXTestDevice(DeviceIntPtr master);
503extern void SendDevicePresenceEvent(int deviceid, int type);
504
505/* misc event helpers */
506extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event);
507extern Mask GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev);
508void FixUpEventFromWindow(DeviceIntPtr pDev,
509 xEvent *xE,
510 WindowPtr pWin,
511 Window child,
512 Bool calcChild);
513
514/* Implemented by the DDX. */
515extern _X_EXPORT int NewInputDeviceRequest(
516 InputOption *options,
517 DeviceIntPtr *dev);
518extern _X_EXPORT void DeleteInputDeviceRequest(
519 DeviceIntPtr dev);
520
521extern _X_EXPORT void DDXRingBell(
522 int volume,
523 int pitch,
524 int duration);
525
526/* Set to TRUE by default - os/utils.c sets it to FALSE on user request,
527 xfixes/cursor.c uses it to determine if the cursor is enabled */
528extern Bool EnableCursor;
529
530#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