|
|
1.1 root 1: /*
2: * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * The contents of this file constitute Original Code as defined in and
7: * are subject to the Apple Public Source License Version 1.1 (the
8: * "License"). You may not use this file except in compliance with the
9: * License. Please obtain a copy of the License at
10: * http://www.apple.com/publicsource and read it before using this file.
11: *
12: * This Original Code and all software distributed under the License are
13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17: * License for the specific language governing rights and limitations
18: * under the License.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22: #ifndef _IOHIPOINTING_H
23: #define _IOHIPOINTING_H
24:
25: #include <IOKit/hidsystem/IOHIPointing.h>
26: #include <IOKit/hidsystem/IOHIDevice.h>
27: #include <IOKit/hidsystem/IOHIDTypes.h>
28:
29: /* Start Action Definitions */
30:
31: /*
32: * HISTORICAL NOTE:
33: * The following entry points were part of the IOHIPointingEvents
34: * protocol.
35: */
36: typedef void (*RelativePointerEventAction)(OSObject * target,
37: /* buttons */ int buttons,
38: /* deltaX */ int dx,
39: /* deltaY */ int dy,
40: /* atTime */ AbsoluteTime ts);
41:
42: typedef void (*AbsolutePointerEventAction)(OSObject * target,
43: /* buttons */ int buttons,
44: /* at */ Point * newLoc,
45: /* withBounds */ Bounds * bounds,
46: /* inProximity */ bool proximity,
47: /* withPressure */ int pressure,
48: /* withAngle */ int stylusAngle,
49: /* atTime */ AbsoluteTime ts);
50:
51: typedef void (*ScrollWheelEventAction)(OSObject * target,
52: short deltaAxis1,
53: short deltaAxis2,
54: short deltaAxis3,
55: AbsoluteTime ts);
56:
57: /* End Action Definitions */
58:
59: typedef struct
60: {
61: IOFixed deviceSpeed;
62: IOFixed cursorSpeed;
63: } IOHIAccelerationPoint;
64:
65: class IOHIPointing : public IOHIDevice
66: {
67: OSDeclareDefaultStructors(IOHIPointing);
68:
69: private:
70: IOLock * _deviceLock; // Lock for all device access
71: int _buttonMode; // The "handedness" of the pointer
72: IOFixed _acceleration;
73: bool _convertAbsoluteToRelative;
74: bool _contactToMove;
75: bool _hadContact;
76: Point _previousLocation;
77: 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
78: #define MAXMAG 128
79: int _scaleValues[MAXMAG];
80: IOFixed _fractX;
81: IOFixed _fractY;
82:
83: OSObject * _relativePointerEventTarget;
84: RelativePointerEventAction _relativePointerEventAction;
85: OSObject * _absolutePointerEventTarget;
86: AbsolutePointerEventAction _absolutePointerEventAction;
87: OSObject * _scrollWheelEventTarget;
88: ScrollWheelEventAction _scrollWheelEventAction;
89:
90:
91: protected:
92: virtual void dispatchRelativePointerEvent(int dx,
93: int dy,
94: UInt32 buttonState,
95: AbsoluteTime ts);
96:
97: virtual void dispatchAbsolutePointerEvent(Point * newLoc,
98: Bounds * bounds,
99: UInt32 buttonState,
100: bool proximity,
101: int pressure,
102: int pressureMin,
103: int pressureMax,
104: int stylusAngle,
105: AbsoluteTime ts);
106:
107: virtual void dispatchScrollWheelEvent(short deltaAxis1,
108: short deltaAxis2,
109: short deltaAxis3,
110: AbsoluteTime ts);
111:
112: public:
113: virtual bool init(OSDictionary * properties = 0);
114: virtual bool start(IOService * provider);
115: virtual void free();
116:
117: virtual bool open(IOService * client,
118: IOOptionBits options,
119: RelativePointerEventAction rpeAction,
120: AbsolutePointerEventAction apeAction,
121: ScrollWheelEventAction sweAction);
122: virtual void close(IOService * client, IOOptionBits );
123:
124: virtual IOHIDKind hidKind();
125: virtual bool updateProperties( void );
126: virtual IOReturn setParamProperties(OSDictionary * dict);
127:
128: protected: // for subclasses to implement
129: virtual void accelerationTable(IOHIAccelerationPoint ** table,
130: IOItemCount * numEntries);
131: virtual IOItemCount buttonCount();
132: virtual IOFixed resolution();
133:
134: private:
135: virtual bool resetPointer();
136: virtual void scalePointer(int * dxp, int * dyp);
137: virtual void setupForAcceleration(IOFixed accl);
138: };
139:
140: #endif /* !_IOHIPOINTING_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.