1
/* $XConsortium: xf86Xinput.h /main/11 1996/10/27 11:05:29 kaleb $ */
3
* Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org>
5
* Permission to use, copy, modify, distribute, and sell this software and its
6
* documentation for any purpose is hereby granted without fee, provided that
7
* the above copyright notice appear in all copies and that both that
8
* copyright notice and this permission notice appear in supporting
9
* documentation, and that the name of Frederic Lepied not be used in
10
* advertising or publicity pertaining to distribution of the software without
11
* specific, written prior permission. Frederic Lepied makes no
12
* representations about the suitability of this software for any purpose. It
13
* is provided "as is" without express or implied warranty.
15
* FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17
* EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21
* PERFORMANCE OF THIS SOFTWARE.
25
/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.33 2001/03/04 01:37:09 tsi Exp $ */
36
#include "extensions/XI.h"
37
#include "extensions/XIproto.h"
41
/* Input device flags */
42
#define XI86_OPEN_ON_INIT 0x01 /* open the device at startup time */
43
#define XI86_CONFIGURED 0x02 /* the device has been configured */
44
#define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
45
/* the device sends Xinput and core pointer events */
46
#define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE
47
/* if the device is the core pointer or is sending core events, and
48
* SEND_DRAG_EVENTS is false, and a buttons is done, then no motion events
49
* (mouse drag action) are sent. This is mainly to allow a touch screen to be
50
* used with netscape and other browsers which do strange things if the mouse
51
* moves between button down and button up. With a touch screen, this motion
52
* is common due to the user's finger moving slightly.
54
#define XI86_SEND_DRAG_EVENTS 0x08
55
#define XI86_CORE_POINTER 0x10 /* device is the core pointer */
56
#define XI86_CORE_KEYBOARD 0x20 /* device is the core keyboard */
57
#define XI86_POINTER_CAPABLE 0x40 /* capable of being a core pointer */
58
#define XI86_KEYBOARD_CAPABLE 0x80 /* capable of being a core keyboard */
60
#define XI_PRIVATE(dev) \
61
(((LocalDevicePtr)((dev)->public.devicePrivate))->private)
66
#define DBG(lvl, f) {if ((lvl) <= xf86GetVerbosity()) f;}
68
#ifdef HAS_MOTION_HISTORY
69
#undef HAS_MOTION_HISTORY
71
#define HAS_MOTION_HISTORY(local) ((local)->dev->valuator && (local)->dev->valuator->numMotionEvents)
74
/* This holds the input driver entry and module information. */
75
typedef struct _InputDriverRec {
78
void (*Identify)(int flags);
79
struct _LocalDeviceRec *(*PreInit)(struct _InputDriverRec *drv,
80
IDevPtr dev, int flags);
81
void (*UnInit)(struct _InputDriverRec *drv,
82
struct _LocalDeviceRec *pInfo,
86
} InputDriverRec, *InputDriverPtr;
89
/* This is to input devices what the ScrnInfoRec is to screens. */
91
typedef struct _LocalDeviceRec {
92
struct _LocalDeviceRec *next;
96
Bool (*device_control)(DeviceIntPtr device, int what);
97
void (*read_input)(struct _LocalDeviceRec *local);
98
int (*control_proc)(struct _LocalDeviceRec *local,
100
void (*close_proc)(struct _LocalDeviceRec *local);
101
int (*switch_mode)(ClientPtr client, DeviceIntPtr dev,
103
Bool (*conversion_proc)(struct _LocalDeviceRec *local,
104
int first, int num, int v0,
105
int v1, int v2, int v3, int v4,
106
int v5, int *x, int *y);
107
Bool (*reverse_conversion_proc)(
108
struct _LocalDeviceRec *local,
109
int x, int y, int *valuators);
116
pointer motion_history;
117
ValuatorMotionProcPtr motion_history_proc;
118
unsigned int history_size; /* only for configuration purpose */
126
IntegerFeedbackPtr always_core_feedback;
131
} LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr;
133
typedef struct _DeviceAssocRec
135
char * config_section_name;
136
LocalDevicePtr (*device_allocate)(void);
137
} DeviceAssocRec, *DeviceAssocPtr;
140
extern InputInfoPtr xf86InputDevs;
143
int xf86IsCorePointer(DeviceIntPtr dev);
144
int xf86IsCoreKeyboard(DeviceIntPtr dev);
145
void xf86XInputSetSendCoreEvents(LocalDevicePtr local, Bool always);
146
#define xf86AlwaysCore(a,b) xf86XInputSetSendCoreEvents(a,b)
148
void InitExtInput(void);
149
Bool xf86eqInit(DevicePtr pKbd, DevicePtr pPtr);
150
void xf86eqEnqueue(struct _xEvent *event);
151
void xf86eqProcessInputEvents (void);
152
void xf86eqSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
153
void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
154
int first_valuator, int num_valuators, ...);
155
void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
156
int first_valuator, int num_valuators, ...);
157
void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
158
int is_down, int first_valuator, int num_valuators,
160
void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
161
int is_absolute, int first_valuator, int num_valuators,
163
void xf86MotionHistoryAllocate(LocalDevicePtr local);
164
int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
165
unsigned long start, unsigned long stop,
167
void xf86XinputFinalizeInit(DeviceIntPtr dev);
168
Bool xf86CheckButton(int button, int down);
169
void xf86SwitchCoreDevice(LocalDevicePtr device, DeviceIntPtr core);
170
LocalDevicePtr xf86FirstLocalDevice(void);
171
int xf86ScaleAxis(int Cx, int Sxhigh, int Sxlow, int Rxhigh, int Rxlow);
172
void xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y);
173
void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
174
void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval,
175
int maxval, int resolution, int min_res,
177
void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
178
void xf86AddEnabledDevice(InputInfoPtr pInfo);
179
void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
182
void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
183
void xf86DeleteInputDriver(int drvIndex);
184
InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
185
void xf86DeleteInput(InputInfoPtr pInp, int flags);
188
void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
191
#endif /* _xf86Xinput_h */