VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.5.3/dmxinputinit.h@ 99743

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

export to OSE

  • Property svn:eol-style set to native
File size: 13.9 KB
Line 
1/*
2 * Copyright 2002 Red Hat Inc., Durham, North Carolina.
3 *
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation on the rights to use, copy, modify, merge,
10 * publish, distribute, sublicense, and/or sell copies of the Software,
11 * and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial
16 * portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
22 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 */
27
28/*
29 * Authors:
30 * Rickard E. (Rik) Faith <[email protected]>
31 *
32 */
33
34/** \file
35 * Interface for low-level input support. \see dmxinputinit.c */
36
37#ifndef _DMXINPUTINIT_H_
38#define _DMXINPUTINIT_H_
39
40#include "dmx.h"
41#include "dmxinput.h"
42#include "dmxlog.h"
43
44
45#define DMX_LOCAL_DEFAULT_KEYBOARD "kbd"
46#define DMX_LOCAL_DEFAULT_POINTER "ps2"
47#define DMX_MAX_BUTTONS 256
48#define DMX_MOTION_SIZE 256
49#define DMX_MAX_VALUATORS 32
50#define DMX_MAX_AXES 32
51#define DMX_MAX_XINPUT_EVENT_TYPES 100
52#define DMX_MAP_ENTRIES 16 /* Must be a power of 2 */
53#define DMX_MAP_MASK (DMX_MAP_ENTRIES - 1)
54
55typedef enum {
56 DMX_FUNCTION_GRAB,
57 DMX_FUNCTION_TERMINATE,
58 DMX_FUNCTION_FINE
59} DMXFunctionType;
60
61typedef enum {
62 DMX_LOCAL_HIGHLEVEL,
63 DMX_LOCAL_KEYBOARD,
64 DMX_LOCAL_MOUSE,
65 DMX_LOCAL_OTHER
66} DMXLocalInputType;
67
68typedef enum {
69 DMX_LOCAL_TYPE_LOCAL,
70 DMX_LOCAL_TYPE_CONSOLE,
71 DMX_LOCAL_TYPE_BACKEND,
72 DMX_LOCAL_TYPE_COMMON
73} DMXLocalInputExtType;
74
75typedef enum {
76 DMX_RELATIVE,
77 DMX_ABSOLUTE,
78 DMX_ABSOLUTE_CONFINED
79} DMXMotionType;
80
81/** Stores information from low-level device that is used to initialize
82 * the device at the dix level. */
83typedef struct _DMXLocalInitInfo {
84 int keyboard; /**< Non-zero if the device is a keyboard */
85
86 int keyClass; /**< Non-zero if keys are present */
87 KeySymsRec keySyms; /**< Key symbols */
88 int freemap; /**< If non-zero, free keySyms.map */
89 CARD8 modMap[MAP_LENGTH]; /**< Modifier map */
90#ifdef XKB
91 XkbDescPtr xkb; /**< XKB description */
92 XkbComponentNamesRec names; /**< XKB component names */
93 int freenames; /**< Non-zero if names should be free'd */
94 int force; /**< Do not allow command line override */
95#endif
96
97 int buttonClass; /**< Non-zero if buttons are present */
98 int numButtons; /**< Number of buttons */
99 unsigned char map[DMX_MAX_BUTTONS]; /**< Button map */
100
101 int valuatorClass; /**< Non-zero if valuators are
102 * present */
103 int numRelAxes; /**< Number of relative axes */
104 int numAbsAxes; /**< Number of absolute axes */
105 int minval[DMX_MAX_AXES]; /**< Minimum values */
106 int maxval[DMX_MAX_AXES]; /**< Maximum values */
107 int res[DMX_MAX_AXES]; /**< Resolution */
108 int minres[DMX_MAX_AXES]; /**< Minimum resolutions */
109 int maxres[DMX_MAX_AXES]; /**< Maximum resolutions */
110
111 int focusClass; /**< Non-zero if device can
112 * cause focus */
113 int proximityClass; /**< Non-zero if device
114 * causes proximity events */
115 int kbdFeedbackClass; /**< Non-zero if device has
116 * keyboard feedback */
117 int ptrFeedbackClass; /**< Non-zero if device has
118 * pointer feedback */
119 int ledFeedbackClass; /**< Non-zero if device has
120 * LED indicators */
121 int belFeedbackClass; /**< Non-zero if device has a
122 * bell */
123 int intFeedbackClass; /**< Non-zero if device has
124 * integer feedback */
125 int strFeedbackClass; /**< Non-zero if device has
126 * string feedback */
127
128 int maxSymbols; /**< Maximum symbols */
129 int maxSymbolsSupported; /**< Maximum symbols supported */
130 KeySym *symbols; /**< Key symbols */
131} DMXLocalInitInfo, *DMXLocalInitInfoPtr;
132
133typedef pointer (*dmxCreatePrivateProcPtr)(DeviceIntPtr);
134typedef void (*dmxDestroyPrivateProcPtr)(pointer);
135
136typedef void (*dmxInitProcPtr)(DevicePtr);
137typedef void (*dmxReInitProcPtr)(DevicePtr);
138typedef void (*dmxLateReInitProcPtr)(DevicePtr);
139typedef void (*dmxGetInfoProcPtr)(DevicePtr, DMXLocalInitInfoPtr);
140typedef int (*dmxOnProcPtr)(DevicePtr);
141typedef void (*dmxOffProcPtr)(DevicePtr);
142typedef void (*dmxUpdatePositionProcPtr)(pointer, int x, int y);
143
144typedef void (*dmxVTPreSwitchProcPtr)(pointer); /* Turn I/O Off */
145typedef void (*dmxVTPostSwitchProcPtr)(pointer); /* Turn I/O On */
146typedef void (*dmxVTSwitchReturnProcPtr)(pointer);
147typedef int (*dmxVTSwitchProcPtr)(pointer, int vt,
148 dmxVTSwitchReturnProcPtr, pointer);
149
150typedef void (*dmxMotionProcPtr)(DevicePtr,
151 int *valuators,
152 int firstAxis,
153 int axesCount,
154 DMXMotionType type,
155 DMXBlockType block);
156typedef void (*dmxEnqueueProcPtr)(DevicePtr, int type, int detail,
157 KeySym keySym, XEvent *e,
158 DMXBlockType block);
159typedef int (*dmxCheckSpecialProcPtr)(DevicePtr, KeySym keySym);
160typedef void (*dmxCollectEventsProcPtr)(DevicePtr,
161 dmxMotionProcPtr,
162 dmxEnqueueProcPtr,
163 dmxCheckSpecialProcPtr,
164 DMXBlockType);
165typedef void (*dmxProcessInputProcPtr)(pointer);
166typedef void (*dmxUpdateInfoProcPtr)(pointer, DMXUpdateType, WindowPtr);
167typedef int (*dmxFunctionsProcPtr)(pointer, DMXFunctionType);
168
169typedef void (*dmxKBCtrlProcPtr)(DevicePtr, KeybdCtrl *ctrl);
170typedef void (*dmxMCtrlProcPtr)(DevicePtr, PtrCtrl *ctrl);
171typedef void (*dmxKBBellProcPtr)(DevicePtr, int percent,
172 int volume, int pitch, int duration);
173
174/** Stores a mapping between the device id on the remote X server and
175 * the id on the DMX server */
176typedef struct _DMXEventMap {
177 int remote; /**< Event number on remote X server */
178 int server; /**< Event number (unbiased) on DMX server */
179} DMXEventMap;
180
181/** This is the device-independent structure used by the low-level input
182 * routines. The contents are not exposed to top-level .c files (except
183 * dmxextensions.c). \see dmxinput.h \see dmxextensions.c */
184typedef struct _DMXLocalInputInfo {
185 const char *name; /**< Device name */
186 DMXLocalInputType type; /**< Device type */
187 DMXLocalInputExtType extType; /**< Extended device type */
188 int binding; /**< Count of how many consecutive
189 * structs are bound to the same
190 * device */
191
192 /* Low-level (e.g., keyboard/mouse drivers) */
193
194 dmxCreatePrivateProcPtr create_private; /**< Create
195 * device-dependent
196 * private */
197 dmxDestroyPrivateProcPtr destroy_private; /**< Destroy
198 * device-dependent
199 * private */
200 dmxInitProcPtr init; /**< Initialize device */
201 dmxReInitProcPtr reinit; /**< Reinitialize device
202 * (during a
203 * reconfiguration) */
204 dmxLateReInitProcPtr latereinit; /**< Reinitialize a device
205 * (called very late
206 * during a
207 * reconfiguration) */
208 dmxGetInfoProcPtr get_info; /**< Get device information */
209 dmxOnProcPtr on; /**< Turn device on */
210 dmxOffProcPtr off; /**< Turn device off */
211 dmxUpdatePositionProcPtr update_position; /**< Called when another
212 * device updates the
213 * cursor position */
214 dmxVTPreSwitchProcPtr vt_pre_switch; /**< Called before a VT switch */
215 dmxVTPostSwitchProcPtr vt_post_switch; /**< Called after a VT switch */
216 dmxVTSwitchProcPtr vt_switch; /**< Causes a VT switch */
217
218 dmxCollectEventsProcPtr collect_events; /**< Collect and enqueue
219 * events from the
220 * device*/
221 dmxProcessInputProcPtr process_input; /**< Process event (from
222 * queue) */
223 dmxFunctionsProcPtr functions;
224 dmxUpdateInfoProcPtr update_info; /**< Update window layout
225 * information */
226
227 dmxMCtrlProcPtr mCtrl; /**< Pointer control */
228 dmxKBCtrlProcPtr kCtrl; /**< Keyboard control */
229 dmxKBBellProcPtr kBell; /**< Bell control */
230
231 pointer private; /**< Device-dependent private */
232 int isCore; /**< Is a DMX core device */
233 int sendsCore; /**< Sends DMX core events */
234 KeybdCtrl kctrl; /**< Keyboard control */
235 PtrCtrl mctrl; /**< Pointer control */
236
237 DeviceIntPtr pDevice; /**< X-level device */
238 int inputIdx; /**< High-level index */
239 int lastX, lastY; /**< Last known position;
240 * for XInput in
241 * dmxevents.c */
242
243 int head; /**< XInput motion history
244 * head */
245 int tail; /**< XInput motion history
246 * tail */
247 unsigned long *history; /**< XInput motion history */
248 int *valuators; /**< Cache of previous values */
249
250 /* for XInput ChangePointerDevice */
251 int (*savedMotionProc)(DeviceIntPtr,
252 xTimecoord *,
253 unsigned long,
254 unsigned long,
255 ScreenPtr);
256 int savedMotionEvents; /**< Saved motion events */
257 int savedSendsCore; /**< Saved sends-core flag */
258
259 DMXEventMap map[DMX_MAP_ENTRIES]; /**< XInput device id map */
260 int mapOptimize; /**< XInput device id
261 * map
262 * optimization */
263
264 long deviceId; /**< device id on remote side,
265 * if any */
266 const char *deviceName; /**< devive name on remote
267 * side, if any */
268} DMXLocalInputInfoRec;
269
270extern DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard;
271
272extern void dmxLocalInitInput(DMXInputInfo *dmxInput);
273extern DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo *dmxInput,
274 DMXLocalInputInfoPtr s);
275
276extern void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl *ctrl);
277extern void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl *ctrl);
278extern void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice,
279 pointer ctrl, int unknown);
280
281extern int dmxInputExtensionErrorHandler(Display *dsp, char *name,
282 char *reason);
283
284extern int dmxInputDetach(DMXInputInfo *dmxInput);
285extern void dmxInputDetachAll(DMXScreenInfo *dmxScreen);
286extern int dmxInputDetachId(int id);
287extern DMXInputInfo *dmxInputLocateId(int id);
288extern int dmxInputAttachConsole(const char *name, int isCore,
289 int *id);
290extern int dmxInputAttachBackend(int physicalScreen, int isCore,
291 int *id);
292
293#endif
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