[PATCH 08/15] More accurate extrapolated fake motion events

Peter Hutterer peter.hutterer at who-t.net
Mon Jun 13 22:08:49 PDT 2011


On Thu, Jun 09, 2011 at 08:57:29PM +0100, Daniel Stone wrote:
> From: Derek Foreman <derek.foreman at collabora.co.uk>
> 
> Use better time estimates so we can provide better fake motion events.
> This reduces the difference between motion with one and two fingers down
> to be almost imperceptible, despite the reporting rate being halved on
> PS/2 devices.
> 
> Signed-off-by: Derek Foreman <derek.foreman at collabora.co.uk>
> Reviewed-by: Daniel Stone <daniel at fooishbar.org>
> ---

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

>  src/synaptics.c    |   12 +++++-------
>  src/synapticsstr.h |    1 +
>  2 files changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/src/synaptics.c b/src/synaptics.c
> index fb37030..560f166 100644
> --- a/src/synaptics.c
> +++ b/src/synaptics.c
> @@ -1793,7 +1793,7 @@ get_edge_speed(SynapticsPrivate *priv, const struct SynapticsHwState *hw,
>   */
>  
>  static void regress(SynapticsPrivate *priv, const struct SynapticsHwState *hw,
> -                    double *dx, double *dy)
> +                    double *dx, double *dy, unsigned long start_time)
>  {
>      const SynapticsParameters *pars = &priv->synpara;
>      int i, j;
> @@ -1826,8 +1826,8 @@ static void regress(SynapticsPrivate *priv, const struct SynapticsHwState *hw,
>      xb1 = xb1n/b1d;
>      yb1 = yb1n/b1d;
>  
> -    *dx = xb1 * (hw->millis - HIST(0).millis);
> -    *dy = yb1 * (hw->millis - HIST(0).millis);
> +    *dx = xb1 * (hw->millis - start_time);
> +    *dy = yb1 * (hw->millis - start_time);
>      return;
>  
>  filtered:
> @@ -1848,9 +1848,8 @@ get_delta(SynapticsPrivate *priv, const struct SynapticsHwState *hw,
>      int y_edge_speed = 0;
>      Bool outlier = FALSE;
>  
> -    /* HIST is full enough: priv->count_packet_finger > 3 */
> -
> -    regress(priv, hw, dx, dy);
> +    regress(priv, hw, dx, dy, priv->last_motion_millis);
> +    priv->last_motion_millis = hw->millis;
>  
>      if ((priv->tap_state == TS_DRAG) || para->edge_motion_use_always)
>          get_edge_speed(priv, hw, edge, &x_edge_speed, &y_edge_speed);
> @@ -2656,7 +2655,6 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
>      /* generate a history of the absolute positions */
>      if (inside_active_area && actual)
>  	store_history(priv, hw->x, hw->y, hw->millis);
> -
>      return delay;
>  }
>  
> diff --git a/src/synapticsstr.h b/src/synapticsstr.h
> index 0174cdb..a496212 100644
> --- a/src/synapticsstr.h
> +++ b/src/synapticsstr.h
> @@ -199,6 +199,7 @@ typedef struct _SynapticsPrivateRec
>      int button_delay_millis;		/* button delay for 3rd button emulation */
>      Bool prev_up;			/* Previous up button value, for double click emulation */
>      enum FingerState finger_state;	/* previous finger state */
> +    unsigned long last_motion_millis;	/* time of the last motion */
>  
>      enum TapState tap_state;		/* State of tap processing */
>      int tap_max_fingers;		/* Max number of fingers seen since entering start state */
> -- 
> 1.7.5.3


 


More information about the xorg-devel mailing list