dix: introduce defines for accel profile numbers

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Simon Thum 2008-07-23 11:28:09 +02:00 committed by Peter Hutterer
parent 4e32e6fb38
commit 87aa529857
2 changed files with 27 additions and 12 deletions

View File

@ -98,7 +98,7 @@ InitVelocityData(DeviceVelocityPtr s)
s->profile_private = NULL; s->profile_private = NULL;
memset(&s->statistics, 0, sizeof(s->statistics)); memset(&s->statistics, 0, sizeof(s->statistics));
memset(&s->filters, 0, sizeof(s->filters)); memset(&s->filters, 0, sizeof(s->filters));
SetAccelerationProfile(s, 0); SetAccelerationProfile(s, AccelProfileClassic);
InitFilterChain(s, (float)1.0/20.0, 1, 1, 40); InitFilterChain(s, (float)1.0/20.0, 1, 1, 40);
} }
@ -551,10 +551,10 @@ LinearProfile(
/** /**
* Set the profile by number. * Set the profile by number.
* Intended to make profiles exchangeable at runtime. * Intended to make profiles exchangeable at runtime.
* If you created a profile, give it a number here to make it selectable. * If you created a profile, give it a number here and in the header to
* In case some profile-specific init is needed, here would be a good place, * make it selectable. In case some profile-specific init is needed, here
* since FreeVelocityData() also calls this with -1. * would be a good place, since FreeVelocityData() also calls this with -1.
* returns FALSE (0) if profile number is unknown. * returns FALSE (0) if profile number is unavailable.
*/ */
int int
SetAccelerationProfile( SetAccelerationProfile(
@ -566,29 +566,31 @@ SetAccelerationProfile(
case -1: case -1:
profile = NULL; /* Special case to uninit properly */ profile = NULL; /* Special case to uninit properly */
break; break;
case 0: case AccelProfileClassic:
profile = ClassicProfile; profile = ClassicProfile;
break; break;
case 1: case AccelProfileDeviceSpecific:
if(NULL == s->deviceSpecificProfile) if(NULL == s->deviceSpecificProfile)
return FALSE; return FALSE;
profile = s->deviceSpecificProfile; profile = s->deviceSpecificProfile;
break; break;
case 2: case AccelProfilePolynomial:
profile = PolynomialAccelerationProfile; profile = PolynomialAccelerationProfile;
break; break;
case 3: case AccelProfileSmoothLinear:
profile = SmoothLinearProfile; profile = SmoothLinearProfile;
break; break;
case 4: case AccelProfileSimple:
profile = SimpleSmoothProfile; profile = SimpleSmoothProfile;
break; break;
case 5: case AccelProfilePower:
profile = PowerProfile; profile = PowerProfile;
break; break;
case 6: case AccelProfileLinear:
profile = LinearProfile; profile = LinearProfile;
break; break;
case AccelProfileReserved:
/* reserved for future use, e.g. a user-defined profile */
default: default:
return FALSE; return FALSE;
} }

View File

@ -29,6 +29,19 @@
#define MAX_VELOCITY_FILTERS 8 #define MAX_VELOCITY_FILTERS 8
/* constants for acceleration profiles;
* see */
#define AccelProfileClassic 0
#define AccelProfileDeviceSpecific 1
#define AccelProfilePolynomial 2
#define AccelProfileSmoothLinear 3
#define AccelProfileSimple 4
#define AccelProfilePower 5
#define AccelProfileLinear 6
#define AccelProfileReserved 7
/* fwd */
struct _DeviceVelocityRec; struct _DeviceVelocityRec;
/** /**