3
* Copyright 2002 Red Hat Inc., Durham, North Carolina.
7
* Permission is hereby granted, free of charge, to any person obtaining
8
* a copy of this software and associated documentation files (the
9
* "Software"), to deal in the Software without restriction, including
10
* without limitation on the rights to use, copy, modify, merge,
11
* publish, distribute, sublicense, and/or sell copies of the Software,
12
* and to permit persons to whom the Software is furnished to do so,
13
* subject to the following conditions:
15
* The above copyright notice and this permission notice (including the
16
* next paragraph) shall be included in all copies or substantial
17
* portions of the Software.
19
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
* NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
23
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
24
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
* Rickard E. (Rik) Faith <faith@redhat.com>
36
* Interface for low-level input support. \see dmxinputinit.c */
38
#ifndef _DMXINPUTINIT_H_
39
#define _DMXINPUTINIT_H_
46
#define DMX_LOCAL_DEFAULT_KEYBOARD "kbd"
47
#define DMX_LOCAL_DEFAULT_POINTER "ps2"
48
#define DMX_MAX_BUTTONS 256
49
#define DMX_MOTION_SIZE 256
50
#define DMX_MAX_VALUATORS 32
51
#define DMX_MAX_AXES 32
52
#define DMX_MAX_XINPUT_EVENT_TYPES 100
53
#define DMX_MAP_ENTRIES 16 /* Must be a power of 2 */
54
#define DMX_MAP_MASK (DMX_MAP_ENTRIES - 1)
58
DMX_FUNCTION_TERMINATE,
71
DMX_LOCAL_TYPE_CONSOLE,
72
DMX_LOCAL_TYPE_BACKEND,
74
} DMXLocalInputExtType;
82
/** Stores information from low-level device that is used to initialize
83
* the device at the dix level. */
84
typedef struct _DMXLocalInitInfo {
85
int keyboard; /**< Non-zero if the device is a keyboard */
87
int keyClass; /**< Non-zero if keys are present */
88
KeySymsRec keySyms; /**< Key symbols */
89
int freemap; /**< If non-zero, free keySyms.map */
90
CARD8 modMap[MAP_LENGTH]; /**< Modifier map */
92
XkbDescPtr xkb; /**< XKB description */
93
XkbComponentNamesRec names; /**< XKB component names */
94
int freenames; /**< Non-zero if names should be free'd */
95
int force; /**< Do not allow command line override */
98
int buttonClass; /**< Non-zero if buttons are present */
99
int numButtons; /**< Number of buttons */
100
unsigned char map[DMX_MAX_BUTTONS]; /**< Button map */
102
int valuatorClass; /**< Non-zero if valuators are
104
int numRelAxes; /**< Number of relative axes */
105
int numAbsAxes; /**< Number of absolute axes */
106
int minval[DMX_MAX_AXES]; /**< Minimum values */
107
int maxval[DMX_MAX_AXES]; /**< Maximum values */
108
int res[DMX_MAX_AXES]; /**< Resolution */
109
int minres[DMX_MAX_AXES]; /**< Minimum resolutions */
110
int maxres[DMX_MAX_AXES]; /**< Maximum resolutions */
112
int focusClass; /**< Non-zero if device can
114
int proximityClass; /**< Non-zero if device
115
* causes proximity events */
116
int kbdFeedbackClass; /**< Non-zero if device has
117
* keyboard feedback */
118
int ptrFeedbackClass; /**< Non-zero if device has
119
* pointer feedback */
120
int ledFeedbackClass; /**< Non-zero if device has
122
int belFeedbackClass; /**< Non-zero if device has a
124
int intFeedbackClass; /**< Non-zero if device has
125
* integer feedback */
126
int strFeedbackClass; /**< Non-zero if device has
129
int maxSymbols; /**< Maximum symbols */
130
int maxSymbolsSupported; /**< Maximum symbols supported */
131
KeySym *symbols; /**< Key symbols */
132
} DMXLocalInitInfo, *DMXLocalInitInfoPtr;
134
typedef pointer (*dmxCreatePrivateProcPtr)(DeviceIntPtr);
135
typedef void (*dmxDestroyPrivateProcPtr)(pointer);
137
typedef void (*dmxInitProcPtr)(DevicePtr);
138
typedef void (*dmxReInitProcPtr)(DevicePtr);
139
typedef void (*dmxLateReInitProcPtr)(DevicePtr);
140
typedef void (*dmxGetInfoProcPtr)(DevicePtr, DMXLocalInitInfoPtr);
141
typedef int (*dmxOnProcPtr)(DevicePtr);
142
typedef void (*dmxOffProcPtr)(DevicePtr);
143
typedef void (*dmxUpdatePositionProcPtr)(pointer, int x, int y);
145
typedef void (*dmxVTPreSwitchProcPtr)(pointer); /* Turn I/O Off */
146
typedef void (*dmxVTPostSwitchProcPtr)(pointer); /* Turn I/O On */
147
typedef void (*dmxVTSwitchReturnProcPtr)(pointer);
148
typedef int (*dmxVTSwitchProcPtr)(pointer, int vt,
149
dmxVTSwitchReturnProcPtr, pointer);
151
typedef void (*dmxMotionProcPtr)(DevicePtr,
157
typedef void (*dmxEnqueueProcPtr)(DevicePtr, int type, int detail,
158
KeySym keySym, XEvent *e,
160
typedef int (*dmxCheckSpecialProcPtr)(DevicePtr, KeySym keySym);
161
typedef void (*dmxCollectEventsProcPtr)(DevicePtr,
164
dmxCheckSpecialProcPtr,
166
typedef void (*dmxProcessInputProcPtr)(pointer);
167
typedef void (*dmxUpdateInfoProcPtr)(pointer, DMXUpdateType, WindowPtr);
168
typedef int (*dmxFunctionsProcPtr)(pointer, DMXFunctionType);
170
typedef void (*dmxKBCtrlProcPtr)(DevicePtr, KeybdCtrl *ctrl);
171
typedef void (*dmxMCtrlProcPtr)(DevicePtr, PtrCtrl *ctrl);
172
typedef void (*dmxKBBellProcPtr)(DevicePtr, int percent,
173
int volume, int pitch, int duration);
175
/** Stores a mapping between the device id on the remote X server and
176
* the id on the DMX server */
177
typedef struct _DMXEventMap {
178
int remote; /**< Event number on remote X server */
179
int server; /**< Event number (unbiased) on DMX server */
182
/** This is the device-independent structure used by the low-level input
183
* routines. The contents are not exposed to top-level .c files (except
184
* dmxextensions.c). \see dmxinput.h \see dmxextensions.c */
185
typedef struct _DMXLocalInputInfo {
186
const char *name; /**< Device name */
187
DMXLocalInputType type; /**< Device type */
188
DMXLocalInputExtType extType; /**< Extended device type */
189
int binding; /**< Count of how many consecutive
190
* structs are bound to the same
193
/* Low-level (e.g., keyboard/mouse drivers) */
195
dmxCreatePrivateProcPtr create_private; /**< Create
198
dmxDestroyPrivateProcPtr destroy_private; /**< Destroy
201
dmxInitProcPtr init; /**< Initialize device */
202
dmxReInitProcPtr reinit; /**< Reinitialize device
204
* reconfiguration) */
205
dmxLateReInitProcPtr latereinit; /**< Reinitialize a device
208
* reconfiguration) */
209
dmxGetInfoProcPtr get_info; /**< Get device information */
210
dmxOnProcPtr on; /**< Turn device on */
211
dmxOffProcPtr off; /**< Turn device off */
212
dmxUpdatePositionProcPtr update_position; /**< Called when another
215
dmxVTPreSwitchProcPtr vt_pre_switch; /**< Called before a VT switch */
216
dmxVTPostSwitchProcPtr vt_post_switch; /**< Called after a VT switch */
217
dmxVTSwitchProcPtr vt_switch; /**< Causes a VT switch */
219
dmxCollectEventsProcPtr collect_events; /**< Collect and enqueue
222
dmxProcessInputProcPtr process_input; /**< Process event (from
224
dmxFunctionsProcPtr functions;
225
dmxUpdateInfoProcPtr update_info; /**< Update window layout
228
dmxMCtrlProcPtr mCtrl; /**< Pointer control */
229
dmxKBCtrlProcPtr kCtrl; /**< Keyboard control */
230
dmxKBBellProcPtr kBell; /**< Bell control */
232
pointer private; /**< Device-dependent private */
233
int isCore; /**< Is a DMX core device */
234
int sendsCore; /**< Sends DMX core events */
235
KeybdCtrl kctrl; /**< Keyboard control */
236
PtrCtrl mctrl; /**< Pointer control */
238
DeviceIntPtr pDevice; /**< X-level device */
239
int inputIdx; /**< High-level index */
240
int lastX, lastY; /**< Last known position;
244
int head; /**< XInput motion history
246
int tail; /**< XInput motion history
248
unsigned long *history; /**< XInput motion history */
249
int *valuators; /**< Cache of previous values */
251
/* for XInput ChangePointerDevice */
252
int (*savedMotionProc)(DeviceIntPtr,
257
int savedMotionEvents; /**< Saved motion events */
258
int savedSendsCore; /**< Saved sends-core flag */
260
DMXEventMap map[DMX_MAP_ENTRIES]; /**< XInput device id map */
261
int mapOptimize; /**< XInput device id
265
long deviceId; /**< device id on remote side,
267
const char *deviceName; /**< devive name on remote
269
} DMXLocalInputInfoRec;
271
extern DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard;
273
extern void dmxLocalInitInput(DMXInputInfo *dmxInput);
274
extern DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo *dmxInput,
275
DMXLocalInputInfoPtr s);
277
extern void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl *ctrl);
278
extern void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl *ctrl);
279
extern void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice,
280
pointer ctrl, int unknown);
282
extern int dmxInputExtensionErrorHandler(Display *dsp, char *name,
285
extern int dmxInputDetach(DMXInputInfo *dmxInput);
286
extern void dmxInputDetachAll(DMXScreenInfo *dmxScreen);
287
extern int dmxInputDetachId(int id);
288
extern DMXInputInfo *dmxInputLocateId(int id);
289
extern int dmxInputAttachConsole(const char *name, int isCore,
291
extern int dmxInputAttachBackend(int physicalScreen, int isCore,