[PATCH libinput 03/16] filter: rename speed to speed_ranged where it's in the [-1, 1] range
Jonas Ã…dahl
jadahl at gmail.com
Mon Aug 10 01:20:50 PDT 2015
On Wed, Aug 05, 2015 at 04:32:32PM +1000, Peter Hutterer wrote:
> 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);
How about speed_adjustment? "speed_range" sounds more like the same type
of speed, but within a range, but IIUC this is more about adjusting the
speed of the movement.
Jonas
> };
>
> 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
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list