dix/ptraccel: Remove float literals
This was fine back when valuators were integer. Device properties are float (not double), so some instances remain. Signed-off-by: Simon Thum <simon.thum@gmx.de> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
c8e5fc3057
commit
16e4bce9e5
|
@ -794,12 +794,12 @@ ComputeAcceleration(DeviceIntPtr dev,
|
||||||
BasicComputeAcceleration(dev, vel, vel->last_velocity, threshold,
|
BasicComputeAcceleration(dev, vel, vel->last_velocity, threshold,
|
||||||
acc);
|
acc);
|
||||||
result +=
|
result +=
|
||||||
4.0f * BasicComputeAcceleration(dev, vel,
|
4.0 * BasicComputeAcceleration(dev, vel,
|
||||||
(vel->last_velocity +
|
(vel->last_velocity +
|
||||||
vel->velocity) / 2,
|
vel->velocity) / 2,
|
||||||
threshold,
|
threshold,
|
||||||
acc);
|
acc);
|
||||||
result /= 6.0f;
|
result /= 6.0;
|
||||||
DebugAccelF("profile average [%.2f ... %.2f] is %.3f\n",
|
DebugAccelF("profile average [%.2f ... %.2f] is %.3f\n",
|
||||||
vel->velocity, vel->last_velocity, result);
|
vel->velocity, vel->last_velocity, result);
|
||||||
}
|
}
|
||||||
|
@ -860,7 +860,7 @@ PowerProfile(DeviceIntPtr dev,
|
||||||
{
|
{
|
||||||
double vel_dist;
|
double vel_dist;
|
||||||
|
|
||||||
acc = (acc - 1.0) * 0.1f + 1.0; /* without this, acc of 2 is unuseable */
|
acc = (acc - 1.0) * 0.1 + 1.0; /* without this, acc of 2 is unuseable */
|
||||||
|
|
||||||
if (velocity <= threshold)
|
if (velocity <= threshold)
|
||||||
return vel->min_acceleration;
|
return vel->min_acceleration;
|
||||||
|
@ -878,9 +878,9 @@ PowerProfile(DeviceIntPtr dev,
|
||||||
static inline double
|
static inline double
|
||||||
CalcPenumbralGradient(double x)
|
CalcPenumbralGradient(double x)
|
||||||
{
|
{
|
||||||
x *= 2.0f;
|
x *= 2.0;
|
||||||
x -= 1.0f;
|
x -= 1.0;
|
||||||
return 0.5f + (x * sqrt(1.0 - x * x) + asin(x)) / M_PI;
|
return 0.5 + (x * sqrt(1.0 - x * x) + asin(x)) / M_PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -916,23 +916,23 @@ SmoothLinearProfile(DeviceIntPtr dev,
|
||||||
{
|
{
|
||||||
double res, nv;
|
double res, nv;
|
||||||
|
|
||||||
if (acc > 1.0f)
|
if (acc > 1.0)
|
||||||
acc -= 1.0f; /*this is so acc = 1 is no acceleration */
|
acc -= 1.0; /*this is so acc = 1 is no acceleration */
|
||||||
else
|
else
|
||||||
return 1.0f;
|
return 1.0;
|
||||||
|
|
||||||
nv = (velocity - threshold) * acc * 0.5f;
|
nv = (velocity - threshold) * acc * 0.5;
|
||||||
|
|
||||||
if (nv < 0) {
|
if (nv < 0) {
|
||||||
res = 0;
|
res = 0;
|
||||||
}
|
}
|
||||||
else if (nv < 2) {
|
else if (nv < 2) {
|
||||||
res = CalcPenumbralGradient(nv * 0.25f) * 2.0f;
|
res = CalcPenumbralGradient(nv * 0.25) * 2.0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nv -= 2.0f;
|
nv -= 2.0;
|
||||||
res = nv * 2.0f / M_PI /* steepness of gradient at 0.5 */
|
res = nv * 2.0 / M_PI /* steepness of gradient at 0.5 */
|
||||||
+ 1.0f; /* gradient crosses 2|1 */
|
+ 1.0; /* gradient crosses 2|1 */
|
||||||
}
|
}
|
||||||
res += vel->min_acceleration;
|
res += vel->min_acceleration;
|
||||||
return res;
|
return res;
|
||||||
|
@ -949,7 +949,7 @@ SmoothLimitedProfile(DeviceIntPtr dev,
|
||||||
{
|
{
|
||||||
double res;
|
double res;
|
||||||
|
|
||||||
if (velocity >= threshold || threshold == 0.0f)
|
if (velocity >= threshold || threshold == 0.0)
|
||||||
return acc;
|
return acc;
|
||||||
|
|
||||||
velocity /= threshold; /* should be [0..1[ now */
|
velocity /= threshold; /* should be [0..1[ now */
|
||||||
|
@ -971,7 +971,7 @@ static double
|
||||||
NoProfile(DeviceIntPtr dev,
|
NoProfile(DeviceIntPtr dev,
|
||||||
DeviceVelocityPtr vel, double velocity, double threshold, double acc)
|
DeviceVelocityPtr vel, double velocity, double threshold, double acc)
|
||||||
{
|
{
|
||||||
return 1.0f;
|
return 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PointerAccelerationProfileFunc
|
static PointerAccelerationProfileFunc
|
||||||
|
@ -1091,7 +1091,7 @@ acceleratePointerPredictable(DeviceIntPtr dev, ValuatorMask *val, CARD32 evtime)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (velocitydata->statistics.profile_number == AccelProfileNone &&
|
if (velocitydata->statistics.profile_number == AccelProfileNone &&
|
||||||
velocitydata->const_acceleration == 1.0f) {
|
velocitydata->const_acceleration == 1.0) {
|
||||||
return; /*we're inactive anyway, so skip the whole thing. */
|
return; /*we're inactive anyway, so skip the whole thing. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1119,8 +1119,8 @@ acceleratePointerPredictable(DeviceIntPtr dev, ValuatorMask *val, CARD32 evtime)
|
||||||
(double) dev->ptrfeed->ctrl.den);
|
(double) dev->ptrfeed->ctrl.den);
|
||||||
|
|
||||||
DebugAccelF("mult is %f\n", mult);
|
DebugAccelF("mult is %f\n", mult);
|
||||||
if (mult != 1.0f || velocitydata->const_acceleration != 1.0f) {
|
if (mult != 1.0 || velocitydata->const_acceleration != 1.0) {
|
||||||
if (mult > 1.0f && soften)
|
if (mult > 1.0 && soften)
|
||||||
ApplySoftening(velocitydata, &dx, &dy);
|
ApplySoftening(velocitydata, &dx, &dy);
|
||||||
ApplyConstantDeceleration(velocitydata, &dx, &dy);
|
ApplyConstantDeceleration(velocitydata, &dx, &dy);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user