diff options
author | marha <marha@users.sourceforge.net> | 2009-09-09 05:23:48 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-09-09 05:23:48 +0000 |
commit | 81f91c615982e50bb62708201569c33a3cd3d973 (patch) | |
tree | 4f32ecc48a3b7b5e76642f3792338263c53879bd /xorg-server/include/ptrveloc.h | |
parent | b571a562410f565af2bdde52d9f7f9a23ffae04f (diff) | |
parent | a915739887477b28d924ecc8417ee107d125bd6c (diff) | |
download | vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.tar.gz vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.tar.bz2 vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.zip |
svn merge https://vcxsrv.svn.sourceforge.net/svnroot/vcxsrv/branches/released .
Diffstat (limited to 'xorg-server/include/ptrveloc.h')
-rw-r--r-- | xorg-server/include/ptrveloc.h | 102 |
1 files changed, 52 insertions, 50 deletions
diff --git a/xorg-server/include/ptrveloc.h b/xorg-server/include/ptrveloc.h index 384f9a6f2..fa2156b0d 100644 --- a/xorg-server/include/ptrveloc.h +++ b/xorg-server/include/ptrveloc.h @@ -1,6 +1,6 @@ /* * - * Copyright © 2006-2008 Simon Thum simon dot thum at gmx dot de + * Copyright © 2006-2009 Simon Thum simon dot thum at gmx dot de * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -27,14 +27,9 @@ #include <input.h> /* DeviceIntPtr */ -/* maximum number of filters to approximate velocity. - * ABI-breaker! - */ -#define MAX_VELOCITY_FILTERS 8 - -/* constants for acceleration profiles; - * see */ +/* constants for acceleration profiles */ +#define AccelProfileNone -1 #define AccelProfileClassic 0 #define AccelProfileDeviceSpecific 1 #define AccelProfilePolynomial 2 @@ -42,7 +37,7 @@ #define AccelProfileSimple 4 #define AccelProfilePower 5 #define AccelProfileLinear 6 -#define AccelProfileReserved 7 +#define AccelProfileLAST AccelProfileLinear /* fwd */ struct _DeviceVelocityRec; @@ -52,80 +47,87 @@ struct _DeviceVelocityRec; * returns actual acceleration depending on velocity, acceleration control,... */ typedef float (*PointerAccelerationProfileFunc) - (struct _DeviceVelocityRec* /*pVel*/, - float /*velocity*/, float /*threshold*/, float /*acc*/); + (DeviceIntPtr dev, struct _DeviceVelocityRec* vel, + float velocity, float threshold, float accelCoeff); /** - * a filter stage contains the data for adaptive IIR filtering. - * To improve results, one may run several parallel filters - * which have different decays. Since more integration means more - * delay, a given filter only does good matches in a specific phase of - * a stroke. - * - * Basically, the coupling feature makes one filter fairly enough, - * so that is the default. + * a motion history, with just enough information to + * calc mean velocity and decide which motion was along + * a more or less straight line */ -typedef struct _FilterStage { - float* fading_lut; /* lookup for adaptive IIR filter */ - int fading_lut_size; /* size of lookup table */ - float rdecay; /* reciprocal weighting halflife in ms */ - float current; -} FilterStage, *FilterStagePtr; +typedef struct _MotionTracker { + int dx, dy; /* accumulated delta for each axis */ + int time; /* time of creation */ + int dir; /* initial direction bitfield */ +} MotionTracker, *MotionTrackerPtr; /** * Contains all data needed to implement mouse ballistics */ typedef struct _DeviceVelocityRec { - FilterStage filters[MAX_VELOCITY_FILTERS]; + MotionTrackerPtr tracker; + int num_tracker; + int cur_tracker; /* current index */ float velocity; /* velocity as guessed by algorithm */ float last_velocity; /* previous velocity estimate */ - int lrm_time; /* time the last motion event was processed */ - int last_dx, last_dy; /* last motion delta */ - int last_diff; /* last time-difference */ - Bool last_reset; /* whether a nv-reset occurred just before */ + int last_dx; /* last time-difference */ + int last_dy ; /* phase of last/current estimate */ float corr_mul; /* config: multiply this into velocity */ float const_acceleration; /* config: (recipr.) const deceleration */ float min_acceleration; /* config: minimum acceleration */ short reset_time; /* config: reset non-visible state after # ms */ short use_softening; /* config: use softening of mouse values */ - float coupling; /* config: max. divergence before coupling */ + float max_rel_diff; /* config: max. relative difference */ + float max_diff; /* config: max. difference */ + int initial_range; /* config: max. offset used as initial velocity */ Bool average_accel; /* config: average acceleration over velocity */ PointerAccelerationProfileFunc Profile; PointerAccelerationProfileFunc deviceSpecificProfile; void* profile_private;/* extended data, see SetAccelerationProfile() */ struct { /* to be able to query this information */ int profile_number; - int filter_usecount[MAX_VELOCITY_FILTERS +1]; } statistics; } DeviceVelocityRec, *DeviceVelocityPtr; -extern void -InitVelocityData(DeviceVelocityPtr s); +extern _X_EXPORT void +InitVelocityData(DeviceVelocityPtr vel); + +extern _X_EXPORT void +InitTrackers(DeviceVelocityPtr vel, int ntracker); + +extern _X_EXPORT short +ProcessVelocityData2D(DeviceVelocityPtr vel, int dx, int dy, int time); + +extern _X_EXPORT float +BasicComputeAcceleration(DeviceIntPtr dev, DeviceVelocityPtr vel, + float velocity, float threshold, float acc); + +extern _X_EXPORT void +FreeVelocityData(DeviceVelocityPtr vel); -extern void -InitFilterChain(DeviceVelocityPtr s, float rdecay, float degression, - int lutsize, int stages); +extern _X_INTERNAL BOOL +InitializePredictableAccelerationProperties(DeviceIntPtr dev); -extern int -SetAccelerationProfile(DeviceVelocityPtr s, int profile_num); +extern _X_EXPORT int +SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num); -extern DeviceVelocityPtr -GetDevicePredictableAccelData(DeviceIntPtr pDev); +extern _X_EXPORT DeviceVelocityPtr +GetDevicePredictableAccelData(DeviceIntPtr dev); -extern void -SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr s, +extern _X_EXPORT void +SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel, PointerAccelerationProfileFunc profile); -extern void -AccelerationDefaultCleanup(DeviceIntPtr pDev); +extern _X_INTERNAL void +AccelerationDefaultCleanup(DeviceIntPtr dev); -extern void -acceleratePointerPredictable(DeviceIntPtr pDev, int first_valuator, +extern _X_INTERNAL void +acceleratePointerPredictable(DeviceIntPtr dev, int first_valuator, int num_valuators, int *valuators, int evtime); -extern void -acceleratePointerLightweight(DeviceIntPtr pDev, int first_valuator, - int num_valuators, int *valuators, int ignore); +extern _X_INTERNAL void +acceleratePointerLightweight(DeviceIntPtr dev, int first_valuator, + int num_valuators, int *valuators, int ignored); #endif /* POINTERVELOCITY_H */ |