]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/hidsystem/IOHIPointing.h
37b692add8c8762b2209a02672d8cbab65f2f441
[apple/xnu.git] / iokit / IOKit / hidsystem / IOHIPointing.h
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 class IOHIPointing : public IOHIDevice
60 {
61 OSDeclareDefaultStructors(IOHIPointing);
62
63 private:
64 IOLock * _deviceLock; // Lock for all device access
65 int _buttonMode; // The "handedness" of the pointer
66 IOFixed _acceleration;
67 bool _convertAbsoluteToRelative;
68 bool _contactToMove;
69 bool _hadContact;
70 Point _previousLocation;
71 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
72 void * _scaleSegments;
73 IOItemCount _scaleSegCount;
74 IOFixed _fractX;
75 IOFixed _fractY;
76
77 OSObject * _relativePointerEventTarget;
78 RelativePointerEventAction _relativePointerEventAction;
79 OSObject * _absolutePointerEventTarget;
80 AbsolutePointerEventAction _absolutePointerEventAction;
81 OSObject * _scrollWheelEventTarget;
82 ScrollWheelEventAction _scrollWheelEventAction;
83
84
85 protected:
86 virtual void dispatchRelativePointerEvent(int dx,
87 int dy,
88 UInt32 buttonState,
89 AbsoluteTime ts);
90
91 virtual void dispatchAbsolutePointerEvent(Point * newLoc,
92 Bounds * bounds,
93 UInt32 buttonState,
94 bool proximity,
95 int pressure,
96 int pressureMin,
97 int pressureMax,
98 int stylusAngle,
99 AbsoluteTime ts);
100
101 virtual void dispatchScrollWheelEvent(short deltaAxis1,
102 short deltaAxis2,
103 short deltaAxis3,
104 AbsoluteTime ts);
105
106 public:
107 virtual bool init(OSDictionary * properties = 0);
108 virtual bool start(IOService * provider);
109 virtual void free();
110
111 virtual bool open(IOService * client,
112 IOOptionBits options,
113 RelativePointerEventAction rpeAction,
114 AbsolutePointerEventAction apeAction,
115 ScrollWheelEventAction sweAction);
116 virtual void close(IOService * client, IOOptionBits );
117
118 virtual IOHIDKind hidKind();
119 virtual bool updateProperties( void );
120 virtual IOReturn setParamProperties(OSDictionary * dict);
121 IOReturn powerStateWillChangeTo ( IOPMPowerFlags, unsigned long, IOService*);
122 IOReturn powerStateDidChangeTo ( IOPMPowerFlags, unsigned long, IOService*);
123 IOService * _rootDomain; //Needs to be public for C function use
124
125
126 protected: // for subclasses to implement
127 virtual OSData * copyAccelerationTable();
128 virtual IOItemCount buttonCount();
129 virtual IOFixed resolution();
130
131 private:
132 virtual bool resetPointer();
133 virtual void scalePointer(int * dxp, int * dyp);
134 virtual void setupForAcceleration(IOFixed accl);
135 };
136
137 #endif /* !_IOHIPOINTING_H */