dix: ptraccel - Add GetAccelerationProfile()
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
This commit is contained in:
parent
beb749c87f
commit
fbb57a2c54
|
@ -75,7 +75,8 @@ CleanupFilterChain(DeviceVelocityPtr s);
|
||||||
static float
|
static float
|
||||||
SimpleSmoothProfile(DeviceVelocityPtr pVel, float velocity,
|
SimpleSmoothProfile(DeviceVelocityPtr pVel, float velocity,
|
||||||
float threshold, float acc);
|
float threshold, float acc);
|
||||||
|
static PointerAccelerationProfileFunc
|
||||||
|
GetAccelerationProfile(DeviceVelocityPtr s, int profile_num);
|
||||||
|
|
||||||
|
|
||||||
/*#define PTRACCEL_DEBUGGING*/
|
/*#define PTRACCEL_DEBUGGING*/
|
||||||
|
@ -675,6 +676,33 @@ LinearProfile(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static PointerAccelerationProfileFunc
|
||||||
|
GetAccelerationProfile(
|
||||||
|
DeviceVelocityPtr s,
|
||||||
|
int profile_num)
|
||||||
|
{
|
||||||
|
switch(profile_num){
|
||||||
|
case AccelProfileClassic:
|
||||||
|
return ClassicProfile;
|
||||||
|
case AccelProfileDeviceSpecific:
|
||||||
|
return s->deviceSpecificProfile;
|
||||||
|
case AccelProfilePolynomial:
|
||||||
|
return PolynomialAccelerationProfile;
|
||||||
|
case AccelProfileSmoothLinear:
|
||||||
|
return SmoothLinearProfile;
|
||||||
|
case AccelProfileSimple:
|
||||||
|
return SimpleSmoothProfile;
|
||||||
|
case AccelProfilePower:
|
||||||
|
return PowerProfile;
|
||||||
|
case AccelProfileLinear:
|
||||||
|
return LinearProfile;
|
||||||
|
case AccelProfileReserved:
|
||||||
|
/* reserved for future use, e.g. a user-defined profile */
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the profile by number.
|
* Set the profile by number.
|
||||||
* Intended to make profiles exchangeable at runtime.
|
* Intended to make profiles exchangeable at runtime.
|
||||||
|
@ -689,38 +717,11 @@ SetAccelerationProfile(
|
||||||
int profile_num)
|
int profile_num)
|
||||||
{
|
{
|
||||||
PointerAccelerationProfileFunc profile;
|
PointerAccelerationProfileFunc profile;
|
||||||
switch(profile_num){
|
profile = GetAccelerationProfile(s, profile_num);
|
||||||
case -1:
|
|
||||||
profile = NULL; /* Special case to uninit properly */
|
if(profile == NULL && profile_num != -1)
|
||||||
break;
|
|
||||||
case AccelProfileClassic:
|
|
||||||
profile = ClassicProfile;
|
|
||||||
break;
|
|
||||||
case AccelProfileDeviceSpecific:
|
|
||||||
if(NULL == s->deviceSpecificProfile)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
profile = s->deviceSpecificProfile;
|
|
||||||
break;
|
|
||||||
case AccelProfilePolynomial:
|
|
||||||
profile = PolynomialAccelerationProfile;
|
|
||||||
break;
|
|
||||||
case AccelProfileSmoothLinear:
|
|
||||||
profile = SmoothLinearProfile;
|
|
||||||
break;
|
|
||||||
case AccelProfileSimple:
|
|
||||||
profile = SimpleSmoothProfile;
|
|
||||||
break;
|
|
||||||
case AccelProfilePower:
|
|
||||||
profile = PowerProfile;
|
|
||||||
break;
|
|
||||||
case AccelProfileLinear:
|
|
||||||
profile = LinearProfile;
|
|
||||||
break;
|
|
||||||
case AccelProfileReserved:
|
|
||||||
/* reserved for future use, e.g. a user-defined profile */
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if(s->profile_private != NULL){
|
if(s->profile_private != NULL){
|
||||||
/* Here one could free old profile-private data */
|
/* Here one could free old profile-private data */
|
||||||
xfree(s->profile_private);
|
xfree(s->profile_private);
|
||||||
|
|
Loading…
Reference in New Issue