#ifndef _IOHIPOINTING_H
#define _IOHIPOINTING_H
#include <IOKit/hidsystem/IOHIPointing.h>
#include <IOKit/hidsystem/IOHIDevice.h>
#include <IOKit/hidsystem/IOHIDTypes.h>
typedef void (*RelativePointerEventAction)(OSObject * target,
int buttons,
int dx,
int dy,
AbsoluteTime ts);
typedef void (*AbsolutePointerEventAction)(OSObject * target,
int buttons,
Point * newLoc,
Bounds * bounds,
bool proximity,
int pressure,
int stylusAngle,
AbsoluteTime ts);
typedef void (*ScrollWheelEventAction)(OSObject * target,
short deltaAxis1,
short deltaAxis2,
short deltaAxis3,
AbsoluteTime ts);
typedef void (*RelativePointerEventCallback)(
OSObject * target,
int buttons,
int dx,
int dy,
AbsoluteTime ts,
OSObject * sender,
void * refcon);
typedef void (*AbsolutePointerEventCallback)(
OSObject * target,
int buttons,
Point * newLoc,
Bounds * bounds,
bool proximity,
int pressure,
int stylusAngle,
AbsoluteTime ts,
OSObject * sender,
void * refcon);
typedef void (*ScrollWheelEventCallback)(
OSObject * target,
short deltaAxis1,
short deltaAxis2,
short deltaAxis3,
IOFixed fixedDelta1,
IOFixed fixedDelta2,
IOFixed fixedDelta3,
AbsoluteTime ts,
OSObject * sender,
void * refcon);
class IOHIDPointingDevice;
class IOHIPointing : public IOHIDevice
{
OSDeclareDefaultStructors(IOHIPointing);
friend class IOHITablet;
private:
IOLock * _deviceLock; int _buttonMode; IOFixed _acceleration;
bool _convertAbsoluteToRelative;
bool _contactToMove;
bool _hadContact;
Point _previousLocation;
UInt8 _pressureThresholdToClick; void * _scaleSegments;
IOItemCount _scaleSegCount;
IOFixed _fractX;
IOFixed _fractY;
OSObject * _relativePointerEventTarget;
RelativePointerEventAction _relativePointerEventAction;
OSObject * _absolutePointerEventTarget;
AbsolutePointerEventAction _absolutePointerEventAction;
OSObject * _scrollWheelEventTarget;
ScrollWheelEventAction _scrollWheelEventAction;
#define SCROLL_TIME_DELTA_COUNT 8
struct ExpansionData {
IOFixed scrollAcceleration;
void * scrollScaleSegments;
IOItemCount scrollScaleSegCount;
UInt32 scrollTimeDeltas1[SCROLL_TIME_DELTA_COUNT];
UInt32 scrollTimeDeltas2[SCROLL_TIME_DELTA_COUNT];
UInt32 scrollTimeDeltas3[SCROLL_TIME_DELTA_COUNT];
UInt8 scrollTimeDeltaIndex1;
UInt8 scrollTimeDeltaIndex2;
UInt8 scrollTimeDeltaIndex3;
IOFixed scrollLastDeltaAxis1;
IOFixed scrollLastDeltaAxis2;
IOFixed scrollLastDeltaAxis3;
IOFixed scrollFixedDeltaAxis1;
IOFixed scrollFixedDeltaAxis2;
IOFixed scrollFixedDeltaAxis3;
AbsoluteTime scrollLastEventTime1;
AbsoluteTime scrollLastEventTime2;
AbsoluteTime scrollLastEventTime3;
IOHIDPointingDevice * hidPointingNub;
IOService * openClient;
bool isSeized;
};
ExpansionData * _reserved;
protected:
virtual void dispatchRelativePointerEvent(int dx,
int dy,
UInt32 buttonState,
AbsoluteTime ts);
virtual void dispatchAbsolutePointerEvent(Point * newLoc,
Bounds * bounds,
UInt32 buttonState,
bool proximity,
int pressure,
int pressureMin,
int pressureMax,
int stylusAngle,
AbsoluteTime ts);
virtual void dispatchScrollWheelEvent(short deltaAxis1,
short deltaAxis2,
short deltaAxis3,
AbsoluteTime ts);
public:
virtual bool init(OSDictionary * properties = 0);
virtual bool start(IOService * provider);
virtual void stop( IOService * provider );
virtual void free();
virtual bool open(IOService * client,
IOOptionBits options,
RelativePointerEventAction rpeAction,
AbsolutePointerEventAction apeAction,
ScrollWheelEventAction sweAction);
bool open( IOService * client,
IOOptionBits options,
void *,
RelativePointerEventCallback rpeCallback,
AbsolutePointerEventCallback apeCallback,
ScrollWheelEventCallback sweCallback);
virtual void close(IOService * client, IOOptionBits );
virtual IOReturn message( UInt32 type, IOService * provider,
void * argument = 0 );
virtual IOHIDKind hidKind();
virtual bool updateProperties( void );
virtual IOReturn setParamProperties( OSDictionary * dict );
virtual IOReturn powerStateWillChangeTo( IOPMPowerFlags powerFlags,
unsigned long newState, IOService * device);
virtual IOReturn powerStateDidChangeTo( IOPMPowerFlags powerFlags,
unsigned long newState, IOService * device);
protected: virtual OSData * copyAccelerationTable();
virtual IOItemCount buttonCount();
virtual IOFixed resolution();
OSData * copyScrollAccelerationTable();
private:
virtual bool resetPointer();
virtual void scalePointer(int * dxp, int * dyp);
virtual void setupForAcceleration(IOFixed accl);
bool resetScroll();
void scaleScrollAxes(IOFixed * axis1p, IOFixed * axis2p, IOFixed * axis3p);
void setupScrollForAcceleration(IOFixed accl);
IOFixed scrollResolution();
private:
static void _relativePointerEvent( IOHIPointing * self,
int buttons,
int dx,
int dy,
AbsoluteTime ts);
static void _absolutePointerEvent(IOHIPointing * self,
int buttons,
Point * newLoc,
Bounds * bounds,
bool proximity,
int pressure,
int stylusAngle,
AbsoluteTime ts);
static void _scrollWheelEvent(IOHIPointing *self,
short deltaAxis1,
short deltaAxis2,
short deltaAxis3,
AbsoluteTime ts);
};
#endif