[PATCH] libinput_device_config_accel_set_speed: Make acceleration range wider

Peter Hutterer peter.hutterer at who-t.net
Thu Apr 9 23:00:41 PDT 2015


On Thu, Apr 09, 2015 at 04:42:00PM +0200, Hans de Goede wrote:
> The main purpose of this patch is to allow the user to actually slow
> down pointer movement using libinput_device_config_accel_set_speed, this
> is achieved by changing the max-accel setting from "2.0 - speed" to
> "2.0 - speed * 1.5", resulting in a max-accel of 0.5 when the user configures
> speed at -1.0, the other accel profile parameters are adjusted by the same
> factor to keep the curve the same.
> 
> This means that the user can get the exact same behavior as before by
> multiplying the old setting by 0.6667 (2/3), this also means that this
> change not only allows the user to select a slower speed, but to keep
> things balanced the same as before, also a higher speed.
> 
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net> and pushed, though I
changed the subject line to "filter: Make ...." before pushing.

   44ce633..76adf39  master -> master

Cheers,
   Peter

> ---
>  src/filter.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/src/filter.c b/src/filter.c
> index 033201f..962d74d 100644
> --- a/src/filter.c
> +++ b/src/filter.c
> @@ -258,13 +258,15 @@ accelerator_set_speed(struct motion_filter *filter,
>  	assert(speed >= -1.0 && speed <= 1.0);
>  
>  	/* delay when accel kicks in */
> -	accel_filter->threshold = DEFAULT_THRESHOLD - speed/6.0;
> +	accel_filter->threshold = DEFAULT_THRESHOLD - speed / 4.0;
> +	if (accel_filter->threshold < 0.2)
> +		accel_filter->threshold = 0.2;
>  
>  	/* adjust max accel factor */
> -	accel_filter->accel = DEFAULT_ACCELERATION + speed;
> +	accel_filter->accel = DEFAULT_ACCELERATION + speed * 1.5;
>  
>  	/* higher speed -> faster to reach max */
> -	accel_filter->incline = DEFAULT_INCLINE + speed/2.0;
> +	accel_filter->incline = DEFAULT_INCLINE + speed * 0.75;
>  
>  	filter->speed = speed;
>  	return true;
> -- 
> 2.3.4
> 
> _______________________________________________
> 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