Root/
Source at commit 1166 created 13 years 10 days ago. By meklort, Fixed recent Makefile changes. Please do not use /Users/evan/SourceCode/tmp/chameleon/trunk or VPATH. the *only* time you should use /Users/evan/SourceCode/tmp/chameleon/trunk is when setting the SRCROOT variable. Also note that very soon make pkg is going to be removed. The pkg build script in trunk is very out of date. Instead please use the package maker at http://forge.voodooprojects.org/p/chameleonApplications/. Once this is ready for trunk it will be merged. | |
---|---|
1 | /*␊ |
2 | * @APPLE_LICENSE_HEADER_START@␊ |
3 | * ␊ |
4 | * Copyright (c) 1999-2009 Apple Computer, Inc. All Rights Reserved.␊ |
5 | * ␊ |
6 | * This file contains Original Code and/or Modifications of Original Code␊ |
7 | * as defined in and that are subject to the Apple Public Source License␊ |
8 | * Version 2.0 (the 'License'). You may not use this file except in␊ |
9 | * compliance with the License. Please obtain a copy of the License at␊ |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this␊ |
11 | * file.␊ |
12 | * ␊ |
13 | * The Original Code and all software distributed under the License are␊ |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.␊ |
18 | * Please see the License for the specific language governing rights and␊ |
19 | * limitations under the License.␊ |
20 | * ␊ |
21 | * @APPLE_LICENSE_HEADER_END@␊ |
22 | */␊ |
23 | #ifndef _IOHIPOINTING_H␊ |
24 | #define _IOHIPOINTING_H␊ |
25 | ␊ |
26 | #include <IOKit/hidsystem/IOHIPointing.h>␊ |
27 | #include <IOKit/hidsystem/IOHIDevice.h>␊ |
28 | #include <IOKit/hidsystem/IOHIDTypes.h>␊ |
29 | ␊ |
30 | /* Start Action Definitions */␊ |
31 | ␊ |
32 | /*␊ |
33 | * HISTORICAL NOTE:␊ |
34 | * The following entry points were part of the IOHIPointingEvents␊ |
35 | * protocol.␊ |
36 | */␊ |
37 | typedef void (*RelativePointerEventAction)(OSObject * target,␊ |
38 | /* buttons */ int buttons,␊ |
39 | /* deltaX */ int dx,␊ |
40 | /* deltaY */ int dy,␊ |
41 | /* atTime */ AbsoluteTime ts);␊ |
42 | ␊ |
43 | typedef void (*AbsolutePointerEventAction)(OSObject * target,␊ |
44 | /* buttons */ int buttons,␊ |
45 | /* at */ IOGPoint * newLoc,␊ |
46 | /* withBounds */ IOGBounds *bounds,␊ |
47 | /* inProximity */ bool proximity,␊ |
48 | /* withPressure */ int pressure,␊ |
49 | /* withAngle */ int stylusAngle,␊ |
50 | /* atTime */ AbsoluteTime ts);␊ |
51 | ␊ |
52 | typedef void (*ScrollWheelEventAction)(OSObject * target,␊ |
53 | short deltaAxis1,␊ |
54 | short deltaAxis2,␊ |
55 | short deltaAxis3,␊ |
56 | AbsoluteTime ts);␊ |
57 | ␊ |
58 | /* Event Callback Definitions */␊ |
59 | ␊ |
60 | typedef void (*RelativePointerEventCallback)(␊ |
61 | /* target */ OSObject * target,␊ |
62 | /* buttons */ int buttons,␊ |
63 | /* deltaX */ int dx,␊ |
64 | /* deltaY */ int dy,␊ |
65 | /* atTime */ AbsoluteTime ts,␊ |
66 | /* sender */ OSObject * sender,␊ |
67 | /* refcon */ void * refcon);␊ |
68 | ␊ |
69 | typedef void (*AbsolutePointerEventCallback)(␊ |
70 | /* target */ OSObject * target,␊ |
71 | /* buttons */ int buttons,␊ |
72 | /* at */ IOGPoint * newLoc,␊ |
73 | /* withBounds */ IOGBounds *bounds,␊ |
74 | /* inProximity */ bool proximity,␊ |
75 | /* withPressure */ int pressure,␊ |
76 | /* withAngle */ int stylusAngle,␊ |
77 | /* atTime */ AbsoluteTime ts,␊ |
78 | /* sender */ OSObject * sender,␊ |
79 | /* refcon */ void * refcon);␊ |
80 | ␊ |
81 | typedef void (*ScrollWheelEventCallback)(␊ |
82 | /* target */ OSObject * target,␊ |
83 | /* delta1 */ short deltaAxis1,␊ |
84 | /* delta2 */ short deltaAxis2,␊ |
85 | /* delta3 */ short deltaAxis3,␊ |
86 | /* fixedDelta1 */ IOFixed fixedDelta1,␊ |
87 | /* fixedDelta2 */ IOFixed fixedDelta2,␊ |
88 | /* fixedDelta3 */ IOFixed fixedDelta3,␊ |
89 | /* pointDelta1 */ SInt32 pointDelta1,␊ |
90 | /* pointDelta2 */ SInt32 pointDelta2,␊ |
91 | /* pointDelta3 */ SInt32 pointDelta3,␊ |
92 | /* reserved */ SInt32 options,␊ |
93 | /* atTime */ AbsoluteTime ts,␊ |
94 | /* sender */ OSObject * sender,␊ |
95 | /* refcon */ void * refcon);␊ |
96 | ␊ |
97 | /* End Action Definitions */␊ |
98 | ␊ |
99 | /* Default accel level parameters */␊ |
100 | #define EV_DEFAULTPOINTERACCELLEVEL 0x0000b000␊ |
101 | #define EV_DEFAULTSCROLLACCELLEVEL 0x00005000␊ |
102 | ␊ |
103 | class IOHIDPointingDevice;␊ |
104 | struct ScrollAccelInfo;␊ |
105 | ␊ |
106 | class IOHIPointing : public IOHIDevice␊ |
107 | {␊ |
108 | OSDeclareDefaultStructors(IOHIPointing);␊ |
109 | ␊ |
110 | friend class IOHITablet;␊ |
111 | friend class IOHIDPointing;␊ |
112 | ␊ |
113 | private:␊ |
114 | IOLock *␉␉_deviceLock; // Lock for all device access␊ |
115 | int␉␉␉_buttonMode; // The "handedness" of the pointer␊ |
116 | IOFixed␉␉_acceleration;␊ |
117 | bool␉␉_convertAbsoluteToRelative;␊ |
118 | bool␉␉_contactToMove;␊ |
119 | bool␉␉_hadContact;␊ |
120 | IOGPoint _previousLocation;␊ |
121 | UInt8␉␉_pressureThresholdToClick;␉// A scale factor of 0 to 255 to determine how much pressure is necessary to generate a primary mouse click - a value of 255 means no click will be generated␊ |
122 | void *␉␉_scaleSegments;␊ |
123 | IOItemCount␉␉_scaleSegCount;␊ |
124 | IOFixed␉␉_fractX;␊ |
125 | IOFixed␉␉_fractY;␊ |
126 | ␊ |
127 | OSObject * _relativePointerEventTarget;␊ |
128 | RelativePointerEventAction _relativePointerEventAction;␊ |
129 | OSObject * _absolutePointerEventTarget;␊ |
130 | AbsolutePointerEventAction _absolutePointerEventAction;␊ |
131 | OSObject * _scrollWheelEventTarget;␊ |
132 | ScrollWheelEventAction _scrollWheelEventAction;␊ |
133 | ␊ |
134 | struct ExpansionData { ␊ |
135 | UInt32 scrollType;␊ |
136 | ␊ |
137 | ScrollAccelInfo * scrollWheelInfo;␊ |
138 | ScrollAccelInfo * scrollPointerInfo;␊ |
139 | ␊ |
140 | IOFixed␉␉scrollFixedDeltaAxis1;␊ |
141 | IOFixed␉␉scrollFixedDeltaAxis2;␊ |
142 | IOFixed␉␉scrollFixedDeltaAxis3;␊ |
143 | SInt32␉␉scrollPointDeltaAxis1;␊ |
144 | SInt32␉␉scrollPointDeltaAxis2;␊ |
145 | SInt32␉␉scrollPointDeltaAxis3;␊ |
146 | UInt32 scrollButtonMask;␊ |
147 | ␊ |
148 | // Added to post events to the HID Manager␊ |
149 | IOHIDPointingDevice␉* hidPointingNub;␊ |
150 | IOService ␉␉* openClient;␊ |
151 | ␊ |
152 | bool␉␉isSeized;␊ |
153 | UInt32 accelerateMode;␊ |
154 | ␊ |
155 | UInt32 scrollZoomMask;␊ |
156 | bool lastScrollWasZoom;␊ |
157 | bool scrollOff;␊ |
158 | };␊ |
159 | ␊ |
160 | ExpansionData * _reserved;␊ |
161 | ␊ |
162 | void setPointingMode(UInt32 accelerateMode);␊ |
163 | UInt32 getPointingMode ();␊ |
164 | void setScrollType(UInt32 scrollType);␊ |
165 | UInt32 getScrollType();␊ |
166 | ␊ |
167 | void dispatchScrollWheelEventWithAccelInfo(␊ |
168 | SInt32 deltaAxis1,␊ |
169 | SInt32 deltaAxis2,␊ |
170 | SInt32 deltaAxis3,␊ |
171 | ScrollAccelInfo * info,␊ |
172 | AbsoluteTime ts);␊ |
173 | ␊ |
174 | ␊ |
175 | protected:␊ |
176 | virtual void dispatchRelativePointerEvent(int dx,␊ |
177 | int dy,␊ |
178 | UInt32 buttonState,␊ |
179 | AbsoluteTime ts);␊ |
180 | ␊ |
181 | virtual void dispatchAbsolutePointerEvent(IOGPoint *␉newLoc,␊ |
182 | IOGBounds *␉bounds,␊ |
183 | UInt32␉buttonState,␊ |
184 | bool␉proximity,␊ |
185 | int␉␉pressure,␊ |
186 | int␉␉pressureMin,␊ |
187 | int␉␉pressureMax,␊ |
188 | int␉␉stylusAngle,␊ |
189 | AbsoluteTime␉ts);␊ |
190 | ␊ |
191 | virtual void dispatchScrollWheelEvent(short deltaAxis1,␊ |
192 | short deltaAxis2,␊ |
193 | short deltaAxis3,␊ |
194 | AbsoluteTime ts);␊ |
195 | ␊ |
196 | public:␊ |
197 | virtual bool init(OSDictionary * properties = 0);␊ |
198 | virtual bool start(IOService * provider);␊ |
199 | virtual void free();␊ |
200 | ␊ |
201 | virtual bool open(IOService * client,␊ |
202 | ␉␉ IOOptionBits␉ options,␊ |
203 | RelativePointerEventAction rpeAction,␊ |
204 | AbsolutePointerEventAction apeAction,␊ |
205 | ScrollWheelEventAction sweAction);␊ |
206 | ␊ |
207 | bool open( IOService *␉␉␉␉client,␊ |
208 | IOOptionBits␉␉␉options,␊ |
209 | void *,␊ |
210 | RelativePointerEventCallback␉rpeCallback,␊ |
211 | AbsolutePointerEventCallback␉apeCallback,␊ |
212 | ScrollWheelEventCallback␉␉sweCallback);␊ |
213 | ␊ |
214 | virtual void close(IOService * client, IOOptionBits );␊ |
215 | virtual IOReturn message( UInt32 type, IOService * provider,␊ |
216 | void * argument = 0 );␊ |
217 | ␊ |
218 | virtual IOHIDKind hidKind();␊ |
219 | virtual bool ␉ updateProperties( void );␊ |
220 | virtual IOReturn setParamProperties( OSDictionary * dict );␊ |
221 | virtual IOReturn powerStateWillChangeTo( IOPMPowerFlags powerFlags,␊ |
222 | unsigned long newState, IOService * device);␊ |
223 | virtual IOReturn powerStateDidChangeTo( IOPMPowerFlags powerFlags,␊ |
224 | unsigned long newState, IOService * device);␊ |
225 | ␊ |
226 | protected: // for subclasses to implement␊ |
227 | virtual OSData * copyAccelerationTable();␊ |
228 | virtual IOItemCount buttonCount();␊ |
229 | virtual IOFixed resolution();␊ |
230 | ␊ |
231 | // RY: Adding method to copy scroll wheel accel table.␊ |
232 | // Unfortunately, we don't have any padding, so this␊ |
233 | // is going to be non-virtual.␊ |
234 | /*virtual*/ OSData * copyScrollAccelerationTable();␊ |
235 | ␊ |
236 | private:␊ |
237 | virtual bool resetPointer();␊ |
238 | virtual void scalePointer(int * dxp, int * dyp);␊ |
239 | virtual void setupForAcceleration(IOFixed accl);␊ |
240 | ␊ |
241 | // RY: Adding methods to support scroll wheel accel.␊ |
242 | // Unfortunately, we don't have any padding, so these␊ |
243 | // are going to be non-virtual.␊ |
244 | /*virtual*/ bool ␉resetScroll();␊ |
245 | /*virtual*/ void ␉setupScrollForAcceleration(IOFixed accl);␊ |
246 | ␊ |
247 | // RY: We have to make sure that subclasses that will ␊ |
248 | // take advantage of this have their defined resolution ␊ |
249 | // in their property table.␊ |
250 | /*virtual*/ IOFixed␉scrollResolutionForType(SInt32 type=-1);␊ |
251 | /*virtual*/ IOFixed scrollReportRate();␊ |
252 | /*virtual*/ OSData * copyScrollAccelerationTableForType(SInt32 type=-1);␊ |
253 | ␊ |
254 | private:␊ |
255 | static void _relativePointerEvent( IOHIPointing * self,␊ |
256 | ␉␉␉␉ int buttons,␊ |
257 | /* deltaX */ int dx,␊ |
258 | /* deltaY */ int dy,␊ |
259 | /* atTime */ AbsoluteTime ts);␊ |
260 | ␊ |
261 | /* Tablet event reporting */␊ |
262 | static void _absolutePointerEvent(IOHIPointing * self,␊ |
263 | ␉␉␉␉ int buttons,␊ |
264 | /* at */ IOGPoint * newLoc,␊ |
265 | /* withBounds */ IOGBounds *bounds,␊ |
266 | /* inProximity */ bool proximity,␊ |
267 | /* withPressure */ int pressure,␊ |
268 | /* withAngle */ int stylusAngle,␊ |
269 | /* atTime */ AbsoluteTime ts);␊ |
270 | ␊ |
271 | /* Mouse scroll wheel event reporting */␊ |
272 | static void _scrollWheelEvent(IOHIPointing *self,␊ |
273 | short deltaAxis1,␊ |
274 | short deltaAxis2,␊ |
275 | short deltaAxis3,␊ |
276 | AbsoluteTime ts);␊ |
277 | ␊ |
278 | };␊ |
279 | ␊ |
280 | #endif /* !_IOHIPOINTING_H */␊ |
281 |