1 | /* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h,v 1.20 2002/12/17 20:55:23 dawes Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Copyright (c) 1997-1999 by The XFree86 Project, Inc.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /* Public interface to OS-specific mouse support. */
|
---|
8 |
|
---|
9 | #ifndef _XF86OSMOUSE_H_
|
---|
10 | #define _XF86OSMOUSE_H_
|
---|
11 |
|
---|
12 | #include "xf86Xinput.h"
|
---|
13 |
|
---|
14 | /* Mouse interface classes */
|
---|
15 | #define MSE_NONE 0x00
|
---|
16 | #define MSE_SERIAL 0x01 /* serial port */
|
---|
17 | #define MSE_BUS 0x02 /* old bus mouse */
|
---|
18 | #define MSE_PS2 0x04 /* standard read-only PS/2 */
|
---|
19 | #define MSE_XPS2 0x08 /* extended PS/2 */
|
---|
20 | #define MSE_AUTO 0x10 /* auto-detect (PnP) */
|
---|
21 | #define MSE_MISC 0x20 /* The OS layer will identify the
|
---|
22 | * specific protocol names that are
|
---|
23 | * supported for this class. */
|
---|
24 |
|
---|
25 | struct _MouseDevRec;
|
---|
26 |
|
---|
27 | typedef int (*GetInterfaceTypesProc)(void);
|
---|
28 | typedef const char **(*BuiltinNamesProc)(void);
|
---|
29 | typedef Bool (*CheckProtocolProc)(const char *protocol);
|
---|
30 | typedef Bool (*BuiltinPreInitProc)(InputInfoPtr pInfo, const char *protocol,
|
---|
31 | int flags);
|
---|
32 | typedef const char *(*DefaultProtocolProc)(void);
|
---|
33 | typedef const char *(*SetupAutoProc)(InputInfoPtr pInfo, int *protoPara);
|
---|
34 | typedef void (*SetResProc)(InputInfoPtr pInfo, const char* protocol, int rate,
|
---|
35 | int res);
|
---|
36 | typedef void (*checkMovementsProc)(InputInfoPtr,int, int);
|
---|
37 | typedef void (*autoProbeProc)(InputInfoPtr, Bool, Bool);
|
---|
38 | typedef Bool (*collectDataProc)(struct _MouseDevRec *, unsigned char);
|
---|
39 | typedef Bool (*dataGoodProc)(struct _MouseDevRec *);
|
---|
40 |
|
---|
41 | /*
|
---|
42 | * OSMouseInfoRec is used to pass information from the OSMouse layer to the
|
---|
43 | * OS-independent mouse driver.
|
---|
44 | */
|
---|
45 | typedef struct {
|
---|
46 | GetInterfaceTypesProc SupportedInterfaces;
|
---|
47 | BuiltinNamesProc BuiltinNames;
|
---|
48 | CheckProtocolProc CheckProtocol;
|
---|
49 | BuiltinPreInitProc PreInit;
|
---|
50 | DefaultProtocolProc DefaultProtocol;
|
---|
51 | SetupAutoProc SetupAuto;
|
---|
52 | SetResProc SetPS2Res;
|
---|
53 | SetResProc SetBMRes;
|
---|
54 | SetResProc SetMiscRes;
|
---|
55 | } OSMouseInfoRec, *OSMouseInfoPtr;
|
---|
56 |
|
---|
57 | /*
|
---|
58 | * SupportedInterfaces: Returns the mouse interface types that the OS support.
|
---|
59 | * If MSE_MISC is returned, then the BuiltinNames and
|
---|
60 | * CheckProtocol should be set.
|
---|
61 | *
|
---|
62 | * BuiltinNames: Returns the names of the protocols that are fully handled
|
---|
63 | * in the OS-specific code. These are names that don't appear
|
---|
64 | * directly in the main "mouse" driver.
|
---|
65 | *
|
---|
66 | * CheckProtocol: Checks if the protocol name given is supported by the
|
---|
67 | * OS. It should return TRUE for both "builtin" protocols and
|
---|
68 | * protocols of type MSE_MISC that are supported by the OS.
|
---|
69 | *
|
---|
70 | * PreInit: The PreInit function for protocols that are builtin. This
|
---|
71 | * function is passed the protocol name.
|
---|
72 | *
|
---|
73 | * DefaultProtocol: Returns the name of a default protocol that should be used
|
---|
74 | * for the OS when none has been supplied in the config file.
|
---|
75 | * This should only be set when there is a reasonable default.
|
---|
76 | *
|
---|
77 | * SetupAuto: This function can be used to do OS-specific protocol
|
---|
78 | * auto-detection. It returns the name of the detected protocol,
|
---|
79 | * or NULL when detection fails. It may also adjust one or more
|
---|
80 | * of the "protoPara" values for the detected protocol by setting
|
---|
81 | * then to something other than -1.
|
---|
82 | *
|
---|
83 | * SetPS2Res: Set the resolution and sample rate for MSE_PS2 and MSE_XPS2
|
---|
84 | * protocol types.
|
---|
85 | *
|
---|
86 | * SetBMRes: Set the resolution and sample rate for MSE_BM protocol types.
|
---|
87 | *
|
---|
88 | * SetMiscRes: Set the resolution and sample rate for MSE_MISC protocol types.
|
---|
89 | */
|
---|
90 |
|
---|
91 | extern OSMouseInfoPtr xf86OSMouseInit(int flags);
|
---|
92 |
|
---|
93 | /*
|
---|
94 | * Mouse device record. This is shared by the mouse driver and the OSMouse
|
---|
95 | * layer.
|
---|
96 | */
|
---|
97 |
|
---|
98 | typedef void (*PostMseEventProc)(InputInfoPtr pInfo, int buttons,
|
---|
99 | int dx, int dy, int dz, int dw);
|
---|
100 | typedef void (*MouseCommonOptProc)(InputInfoPtr pInfo);
|
---|
101 |
|
---|
102 | typedef struct _MouseDevRec {
|
---|
103 | PtrCtrlProcPtr Ctrl;
|
---|
104 | PostMseEventProc PostEvent;
|
---|
105 | MouseCommonOptProc CommonOptions;
|
---|
106 | DeviceIntPtr device;
|
---|
107 | const char * mseDevice;
|
---|
108 | const char * protocol;
|
---|
109 | int protocolID;
|
---|
110 | int oldProtocolID; /* hack */
|
---|
111 | int class;
|
---|
112 | int mseModel;
|
---|
113 | int baudRate;
|
---|
114 | int oldBaudRate;
|
---|
115 | int sampleRate;
|
---|
116 | int lastButtons;
|
---|
117 | int threshold; /* acceleration */
|
---|
118 | int num;
|
---|
119 | int den;
|
---|
120 | int buttons; /* # of buttons */
|
---|
121 | int emulateState; /* automata state for 2 button mode */
|
---|
122 | Bool emulate3Buttons;
|
---|
123 | Bool emulate3ButtonsSoft;
|
---|
124 | int emulate3Timeout;/* Timeout for 3 button emulation */
|
---|
125 | Bool chordMiddle;
|
---|
126 | Bool flipXY;
|
---|
127 | int invX;
|
---|
128 | int invY;
|
---|
129 | int mouseFlags; /* Flags to Clear after opening
|
---|
130 | * mouse dev */
|
---|
131 | int truebuttons; /* (not used)
|
---|
132 | * Arg to maintain before
|
---|
133 | * emulate3buttons timer callback */
|
---|
134 | int resolution;
|
---|
135 | int negativeZ; /* button mask */
|
---|
136 | int positiveZ; /* button mask */
|
---|
137 | int negativeW; /* button mask */
|
---|
138 | int positiveW; /* button mask */
|
---|
139 | pointer buffer; /* usually an XISBuffer* */
|
---|
140 | int protoBufTail;
|
---|
141 | unsigned char protoBuf[8];
|
---|
142 | unsigned char protoPara[8];
|
---|
143 | unsigned char inSync; /* driver in sync with datastream */
|
---|
144 | pointer mousePriv; /* private area */
|
---|
145 | InputInfoPtr pInfo;
|
---|
146 | int origProtocolID;
|
---|
147 | const char * origProtocol;
|
---|
148 | Bool emulate3Pending;/* timer waiting */
|
---|
149 | CARD32 emulate3Expires;/* time to fire emulation code */
|
---|
150 | Bool emulateWheel;
|
---|
151 | int wheelInertia;
|
---|
152 | int wheelButtonMask;
|
---|
153 | int negativeX; /* Button values. Unlike the Z and */
|
---|
154 | int positiveX; /* W equivalents, these are button */
|
---|
155 | int negativeY; /* values rather than button masks. */
|
---|
156 | int positiveY;
|
---|
157 | int wheelYDistance;
|
---|
158 | int wheelXDistance;
|
---|
159 | Bool autoProbe;
|
---|
160 | checkMovementsProc checkMovements;
|
---|
161 | autoProbeProc autoProbeMouse;
|
---|
162 | collectDataProc collectData;
|
---|
163 | dataGoodProc dataGood;
|
---|
164 | int angleOffset;
|
---|
165 | pointer pDragLock; /* drag lock area */
|
---|
166 | } MouseDevRec, *MouseDevPtr;
|
---|
167 |
|
---|
168 | /* Z axis mapping */
|
---|
169 | #define MSE_NOZMAP 0
|
---|
170 | #define MSE_MAPTOX -1
|
---|
171 | #define MSE_MAPTOY -2
|
---|
172 | #define MSE_MAPTOZ -3
|
---|
173 | #define MSE_MAPTOW -4
|
---|
174 |
|
---|
175 | /* Generalize for other axes. */
|
---|
176 | #define MSE_NOAXISMAP MSE_NOZMAP
|
---|
177 |
|
---|
178 | #define MSE_MAXBUTTONS 12
|
---|
179 | #define MSE_DFLTBUTTONS 3
|
---|
180 |
|
---|
181 | #endif /* _XF86OSMOUSE_H_ */
|
---|