59
59
#include "XIstubs.h"
61
61
/* Input device flags */
62
#define XI86_OPEN_ON_INIT 0x01 /* open the device at startup time */
63
#define XI86_CONFIGURED 0x02 /* the device has been configured */
64
62
#define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
65
63
/* the device sends Xinput and core pointer events */
66
64
#define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE
67
/* if the device is the core pointer or is sending core events, and
68
* SEND_DRAG_EVENTS is false, and a buttons is done, then no motion events
69
* (mouse drag action) are sent. This is mainly to allow a touch screen to be
70
* used with netscape and other browsers which do strange things if the mouse
71
* moves between button down and button up. With a touch screen, this motion
72
* is common due to the user's finger moving slightly.
74
#define XI86_SEND_DRAG_EVENTS 0x08
75
#define XI86_CORE_POINTER 0x10 /* device is the core pointer */
76
#define XI86_CORE_KEYBOARD 0x20 /* device is the core keyboard */
77
#define XI86_POINTER_CAPABLE 0x40 /* capable of being a core pointer */
78
#define XI86_KEYBOARD_CAPABLE 0x80 /* capable of being a core keyboard */
80
#define XI_PRIVATE(dev) \
81
(((LocalDevicePtr)((dev)->public.devicePrivate))->private)
83
/* Valuator verification macro */
84
#define XI_VERIFY_VALUATORS(num_valuators) \
85
if (num_valuators > MAX_VALUATORS) { \
86
xf86Msg(X_ERROR, "%s: num_valuator %d is greater than" \
87
" MAX_VALUATORS\n", __FUNCTION__, num_valuators); \
91
/* Stupid API backwards-compatibility. */
95
66
/* This holds the input driver entry and module information. */
96
67
typedef struct _InputDriverRec {
99
70
void (*Identify)(int flags);
100
struct _LocalDeviceRec *(*PreInit)(struct _InputDriverRec *drv,
101
IDevPtr dev, int flags);
71
int (*PreInit)(struct _InputDriverRec *drv,
72
struct _InputInfoRec* pInfo, int flags);
102
73
void (*UnInit)(struct _InputDriverRec *drv,
103
struct _LocalDeviceRec *pInfo,
74
struct _InputInfoRec *pInfo,
77
char ** default_options;
107
78
} InputDriverRec, *InputDriverPtr;
109
80
/* This is to input devices what the ScrnInfoRec is to screens. */
111
typedef struct _LocalDeviceRec {
112
struct _LocalDeviceRec *next;
82
typedef struct _InputInfoRec {
83
struct _InputInfoRec *next;
116
89
Bool (*device_control)(DeviceIntPtr device, int what);
117
void (*read_input)(struct _LocalDeviceRec *local);
118
int (*control_proc)(struct _LocalDeviceRec *local,
90
void (*read_input)(struct _InputInfoRec *local);
91
int (*control_proc)(struct _InputInfoRec *local,
119
92
xDeviceCtl *control);
120
void (*close_proc)(struct _LocalDeviceRec *local);
121
93
int (*switch_mode)(ClientPtr client, DeviceIntPtr dev,
123
Bool (*conversion_proc)(struct _LocalDeviceRec *local,
124
int first, int num, int v0,
125
int v1, int v2, int v3, int v4,
126
int v5, int *x, int *y);
127
Bool (*reverse_conversion_proc)(
128
struct _LocalDeviceRec *local,
129
int x, int y, int *valuators);
130
95
int (*set_device_valuators)
131
(struct _LocalDeviceRec *local,
96
(struct _InputInfoRec *local,
132
97
int *valuators, int first_valuator,
133
98
int num_valuators);
137
101
DeviceIntPtr dev;
144
103
char * type_name;
145
IntegerFeedbackPtr always_core_feedback;
147
104
InputDriverPtr drv;
150
unsigned int history_size;
151
107
InputAttributes *attrs;
152
} LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr;
154
typedef struct _DeviceAssocRec
156
char * config_section_name;
157
LocalDevicePtr (*device_allocate)(void);
158
} DeviceAssocRec, *DeviceAssocPtr;
160
110
/* xf86Globals.c */
161
extern _X_EXPORT InputInfoPtr xf86InputDevs;
111
extern InputInfoPtr xf86InputDevs;
163
113
/* xf86Xinput.c */
164
114
extern _X_EXPORT void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
165
115
int first_valuator, int num_valuators, ...);
166
116
extern _X_EXPORT void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute,
167
int first_valuator, int num_valuators, int *valuators);
117
int first_valuator, int num_valuators, const int *valuators);
118
extern _X_EXPORT void xf86PostMotionEventM(DeviceIntPtr device, int is_absolute,
119
const ValuatorMask *mask);
168
120
extern _X_EXPORT void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
169
121
int first_valuator, int num_valuators, ...);
170
122
extern _X_EXPORT void xf86PostProximityEventP(DeviceIntPtr device, int is_in, int first_valuator,
171
int num_valuators, int *valuators);
123
int num_valuators, const int *valuators);
124
extern _X_EXPORT void xf86PostProximityEventM(DeviceIntPtr device, int is_in,
125
const ValuatorMask *mask);
172
126
extern _X_EXPORT void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
173
127
int is_down, int first_valuator, int num_valuators,
175
129
extern _X_EXPORT void xf86PostButtonEventP(DeviceIntPtr device, int is_absolute, int button,
176
130
int is_down, int first_valuator, int num_valuators,
131
const int *valuators);
132
extern _X_EXPORT void xf86PostButtonEventM(DeviceIntPtr device, int is_absolute, int button,
133
int is_down, const ValuatorMask *mask);
178
134
extern _X_EXPORT void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
179
135
int is_absolute, int first_valuator, int num_valuators,
137
extern _X_EXPORT void xf86PostKeyEventM(DeviceIntPtr device, unsigned int key_code, int is_down,
138
int is_absolute, const ValuatorMask *mask);
181
139
extern _X_EXPORT void xf86PostKeyEventP(DeviceIntPtr device, unsigned int key_code, int is_down,
182
140
int is_absolute, int first_valuator, int num_valuators,
141
const int *valuators);
184
142
extern _X_EXPORT void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
186
extern _X_EXPORT int xf86ActivateDevice(LocalDevicePtr local);
187
extern _X_EXPORT LocalDevicePtr xf86FirstLocalDevice(void);
188
extern _X_EXPORT int xf86ScaleAxis(int Cx, int Sxhigh, int Sxlow, int Rxhigh, int Rxlow);
189
extern _X_EXPORT void xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y);
144
extern _X_EXPORT InputInfoPtr xf86FirstLocalDevice(void);
145
extern _X_EXPORT int xf86ScaleAxis(int Cx, int to_max, int to_min, int from_max, int from_min);
146
extern _X_EXPORT void xf86XInputSetScreen(InputInfoPtr pInfo, int screen_number, int x, int y);
190
147
extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
191
148
extern _X_EXPORT void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
192
149
int maxval, int resolution, int min_res,
150
int max_res, int mode);
194
151
extern _X_EXPORT void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
195
152
extern _X_EXPORT void xf86AddEnabledDevice(InputInfoPtr pInfo);
196
153
extern _X_EXPORT void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
197
154
extern _X_EXPORT void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
198
155
extern _X_EXPORT void xf86EnableDevice(DeviceIntPtr dev);
199
156
/* not exported */
200
int xf86NewInputDevice(IDevPtr idev, DeviceIntPtr *pdev, BOOL is_auto);
157
int xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL is_auto);
158
InputInfoPtr xf86AllocateInput(void);
202
160
/* xf86Helper.c */
203
161
extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
204
162
extern _X_EXPORT void xf86DeleteInputDriver(int drvIndex);
205
extern _X_EXPORT InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
206
163
extern _X_EXPORT InputDriverPtr xf86LookupInputDriver(const char *name);
207
164
extern _X_EXPORT InputInfoPtr xf86LookupInput(const char *name);
208
165
extern _X_EXPORT void xf86DeleteInput(InputInfoPtr pInp, int flags);
209
extern _X_EXPORT void xf86MotionHistoryAllocate(LocalDevicePtr local);
166
extern _X_EXPORT void xf86MotionHistoryAllocate(InputInfoPtr pInfo);
167
extern _X_EXPORT void xf86IDrvMsgVerb(InputInfoPtr dev,
168
MessageType type, int verb,
169
const char *format, ...) _X_ATTRIBUTE_PRINTF(4,5);
170
extern _X_EXPORT void xf86IDrvMsg(InputInfoPtr dev,
172
const char *format, ...) _X_ATTRIBUTE_PRINTF(3,4);
173
extern _X_EXPORT void xf86VIDrvMsgVerb(InputInfoPtr dev,
211
179
/* xf86Option.c */
212
extern _X_EXPORT void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
217
#define SendCoreEvents 59
218
#define DontSendCoreEvents 60
180
extern _X_EXPORT void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts);
220
182
#endif /* _xf86Xinput_h */