[PATCH] Fix coasting friction

Peter Hutterer peter.hutterer at who-t.net
Mon Apr 16 20:33:39 PDT 2012


On Mon, Apr 16, 2012 at 11:50:03AM +0800, Chow Loong Jin wrote:
> On 16/04/2012 11:44, Chow Loong Jin wrote:
> > [...]
> 
> Whoops, looks like the patch got corrupted, and I forgot to sign-off. Here's the
> amended patch as an attachment instead.
> 
> -- 
> Kind regards,
> Loong Jin

> From 00de516c1325312781a89fad5d7339c1045ee3cb Mon Sep 17 00:00:00 2001
> From: Chow Loong Jin <hyperair at debian.org>
> Date: Mon, 16 Apr 2012 11:39:44 +0800
> Subject: [PATCH] Fix coasting friction
> 
> As a result of commit 5a1612d4496b51682c9043aa064025c545249de6, coasting speed
> was bumped up to a different scale by removing the divisor during the
> calculation of initial coasting speed. This caused coasting friction to have
> little to no effect, resulting in coasting that lasted virtually forever using
> the default coasting friction value of 50.
> 
> This patch multiplies the scroll_dist_{horiz,vert} which was previously used as
> a divisor for initial coasting speed to the coasting friction before deducting
> it at each step, thus bringing coasting friction back under control.
> 
> Signed-off-by: Chow Loong Jin <hyperair at debian.org>

applied, thanks.

Cheers,
  Peter

> ---
>  src/synaptics.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/synaptics.c b/src/synaptics.c
> index 40478ec..2c6b714 100644
> --- a/src/synaptics.c
> +++ b/src/synaptics.c
> @@ -2585,7 +2585,7 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
>  
>      if (priv->scroll.coast_speed_y) {
>  	double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0;
> -	double ddy = para->coasting_friction * dtime;
> +	double ddy = para->coasting_friction * dtime * para->scroll_dist_vert;
>  	priv->scroll.delta_y += priv->scroll.coast_speed_y * dtime;
>  	delay = MIN(delay, POLL_MS);
>  	if (abs(priv->scroll.coast_speed_y) < ddy) {
> @@ -2598,7 +2598,7 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
>  
>      if (priv->scroll.coast_speed_x) {
>  	double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0;
> -	double ddx = para->coasting_friction * dtime;
> +	double ddx = para->coasting_friction * dtime * para->scroll_dist_horiz;
>  	priv->scroll.delta_x += priv->scroll.coast_speed_x * dtime;
>  	delay = MIN(delay, POLL_MS);
>  	if (abs(priv->scroll.coast_speed_x) < ddx) {
> -- 
> 1.7.9.5
> 




> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel



More information about the xorg-devel mailing list