[PATCH] Fix coasting speed

Peter Hutterer peter.hutterer at who-t.net
Thu Apr 12 20:31:52 PDT 2012


On Wed, Mar 28, 2012 at 12:13:30AM +0200, Pierre Lulé wrote:
> Oops, left a typo in previous patch. Here's the correction.
> 
> Fixes a bug introduced in commit 2603ad69b997c999404ecc441e0d64ea2cc22018 (Use the scroll distances as increment for scrolling valuator axes)
> 
> Since this commit, scroll distance was set with SetScrollValuator function but it was still used as a divisor to calculate coasting,
> thus making coasting too slow. (at least on my computer)
> 
> Deleting the divisor fixes the issue.
> 
> A report of the same bug : https://bugs.archlinux.org/task/28955

merged thanks. Please reply to this email with your Signed-off-by tag
though.

http://wiki.x.org/wiki/Development/Documentation/SubmittingPatches#Signing_off_and_reviewing

Cheers,
  Peter


> ---
>  src/synaptics.c |   23 ++++++++++-------------
>  1 file changed, 10 insertions(+), 13 deletions(-)
> 
> diff --git a/src/synaptics.c b/src/synaptics.c
> index 99b5085..696a1f6 100644
> --- a/src/synaptics.c
> +++ b/src/synaptics.c
> @@ -2330,39 +2330,36 @@ start_coasting(SynapticsPrivate *priv, struct SynapticsHwState *hw,
>  	double pkt_time = HIST_DELTA(0, 3, millis) / 1000.0;
>  	if (vert && !circ) {
>  	    double dy = estimate_delta(HIST(0).y, HIST(1).y, HIST(2).y, HIST(3).y);
> -	    int sdelta = para->scroll_dist_vert;
> -	    if (pkt_time > 0 && sdelta > 0) {
> -		double scrolls_per_sec = dy / pkt_time / sdelta;
> +	    if (pkt_time > 0) {
> +		double scrolls_per_sec = dy / pkt_time;
>  		if (fabs(scrolls_per_sec) >= para->coasting_speed) {
>  		    priv->scroll.coast_speed_y = scrolls_per_sec;
> -		    priv->scroll.coast_delta_y = (hw->y - priv->scroll.last_y) / (double)sdelta;
> +		    priv->scroll.coast_delta_y = (hw->y - priv->scroll.last_y);
>  		}
>  	    }
>  	}
>  	if (horiz && !circ){
>  	    double dx = estimate_delta(HIST(0).x, HIST(1).x, HIST(2).x, HIST(3).x);
> -	    int sdelta = para->scroll_dist_horiz;
> -	    if (pkt_time > 0 && sdelta > 0) {
> -		double scrolls_per_sec = dx / pkt_time / sdelta;
> +	    if (pkt_time > 0) {
> +		double scrolls_per_sec = dx / pkt_time;
>  		if (fabs(scrolls_per_sec) >= para->coasting_speed) {
>  		    priv->scroll.coast_speed_x = scrolls_per_sec;
> -		    priv->scroll.coast_delta_x = (hw->x - priv->scroll.last_x) / (double)sdelta;
> +		    priv->scroll.coast_delta_x = (hw->x - priv->scroll.last_x);
>  		}
>  	    }
>  	}
>  	if (circ) {
>  	    double da = estimate_delta_circ(priv);
> -	    double sdelta = para->scroll_dist_circ;
> -	    if (pkt_time > 0 && sdelta > 0) {
> -	        double scrolls_per_sec = da / pkt_time / sdelta;
> +	    if (pkt_time > 0) {
> +	        double scrolls_per_sec = da / pkt_time;
>  	        if (fabs(scrolls_per_sec) >= para->coasting_speed) {
>  	            if (vert) {
>  	                priv->scroll.coast_speed_y = scrolls_per_sec;
> -	                priv->scroll.coast_delta_y = diffa(priv->scroll.last_a, angle(priv, hw->x, hw->y)) / sdelta;
> +	                priv->scroll.coast_delta_y = diffa(priv->scroll.last_a, angle(priv, hw->x, hw->y));
>  	            }
>  	            else if (horiz) {
>  	                priv->scroll.coast_speed_x = scrolls_per_sec;
> -	                priv->scroll.coast_delta_x = diffa(priv->scroll.last_a, angle(priv, hw->x, hw->y)) / sdelta;
> +	                priv->scroll.coast_delta_x = diffa(priv->scroll.last_a, angle(priv, hw->x, hw->y));
>  	            }
>  	        }
>  	    }
> -- 
> 1.7.9.4
> 
> _______________________________________________
> 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