[PATCH libinput 03/16] filter: rename speed to speed_ranged where it's in the [-1, 1] range
Peter Hutterer
peter.hutterer at who-t.net
Tue Aug 4 23:32:32 PDT 2015
To avoid confusion with the other speed in units/time
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/filter-private.h | 4 ++--
src/filter.c | 18 +++++++++---------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/filter-private.h b/src/filter-private.h
index 0e7afa1..c6281ae 100644
--- a/src/filter-private.h
+++ b/src/filter-private.h
@@ -38,11 +38,11 @@ struct motion_filter_interface {
uint64_t time);
void (*destroy)(struct motion_filter *filter);
bool (*set_speed)(struct motion_filter *filter,
- double speed);
+ double speed_ranged);
};
struct motion_filter {
- double speed; /* normalized [-1, 1] */
+ double speed_ranged; /* normalized [-1, 1] */
struct motion_filter_interface *interface;
};
diff --git a/src/filter.c b/src/filter.c
index e615deb..e1c228f 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -62,15 +62,15 @@ filter_destroy(struct motion_filter *filter)
bool
filter_set_speed(struct motion_filter *filter,
- double speed)
+ double speed_ranged)
{
- return filter->interface->set_speed(filter, speed);
+ return filter->interface->set_speed(filter, speed_ranged);
}
double
filter_get_speed(struct motion_filter *filter)
{
- return filter->speed;
+ return filter->speed_ranged;
}
/*
@@ -325,25 +325,25 @@ accelerator_destroy(struct motion_filter *filter)
static bool
accelerator_set_speed(struct motion_filter *filter,
- double speed)
+ double speed_ranged)
{
struct pointer_accelerator *accel_filter =
(struct pointer_accelerator *)filter;
- assert(speed >= -1.0 && speed <= 1.0);
+ assert(speed_ranged >= -1.0 && speed_ranged <= 1.0);
/* delay when accel kicks in */
- accel_filter->threshold = DEFAULT_THRESHOLD - speed / 4000.0;
+ accel_filter->threshold = DEFAULT_THRESHOLD - speed_ranged / 4000.0;
if (accel_filter->threshold < MINIMUM_THRESHOLD)
accel_filter->threshold = MINIMUM_THRESHOLD;
/* adjust max accel factor */
- accel_filter->accel = DEFAULT_ACCELERATION + speed * 1.5;
+ accel_filter->accel = DEFAULT_ACCELERATION + speed_ranged * 1.5;
/* higher speed -> faster to reach max */
- accel_filter->incline = DEFAULT_INCLINE + speed * 0.75;
+ accel_filter->incline = DEFAULT_INCLINE + speed_ranged * 0.75;
- filter->speed = speed;
+ filter->speed_ranged = speed_ranged;
return true;
}
--
2.4.3
More information about the wayland-devel
mailing list