[PATCH synaptics 2/2] Reset scroll delta when finger is lifted

Chase Douglas chase.douglas at canonical.com
Thu Apr 26 07:48:13 PDT 2012


On 04/25/2012 11:22 PM, Peter Hutterer wrote:
> On Wed, Apr 25, 2012 at 10:37:26PM -0700, Chase Douglas wrote:
>> On 04/25/2012 08:00 PM, Peter Hutterer wrote:
>>> Provides for a more consistent scrolling experience, otherwise delta
>>> leftovers may trigger extra events even when the actual scrolling action
>>> stays the same.
>>>
>>> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
>>> ---
>>>  src/synaptics.c |    2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/src/synaptics.c b/src/synaptics.c
>>> index 0546ab9..429f5d0 100644
>>> --- a/src/synaptics.c
>>> +++ b/src/synaptics.c
>>> @@ -2414,6 +2414,8 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
>>>  		DBG(7, "circular scroll detected on edge\n");
>>>  	    }
>>>  	}
>>> +        priv->scroll.delta_y = 0;
>>> +        priv->scroll.delta_x = 0;
>>>      }
>>>      if (!priv->circ_scroll_on) {
>>>  	if (finger) {
>>
>> This path is followed when a finger begins contact, not when a finger is
>> lifted. I'm guessing it is correct, though, because we want to reset the
>> scroll deltas when we start a new motion?
> 
> yeah, sorry. wrong word in the commit msg. FS_UNTOUCHED, the condition this
> is hit at is "no finger is touching". This path is run more often than
> necessary, so it gets reset too often here. But integrating it into the
> state machine requires more changes than I'm comfortable with at this point
> and we need some "reset scrolling state" function anyways. Until that
> exists, this one will do.
> 
> I moved this up a bit (in my local tree) for better readability. Same two
> lines are now  below the call to stop_coasting(). No functional changes
> though.
> 
> diff --git a/src/synaptics.c b/src/synaptics.c
> index 104a2c7..51ecda5 100644
> --- a/src/synaptics.c
> +++ b/src/synaptics.c
> @@ -2398,6 +2398,8 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
>      /* scroll detection */
>      if (finger && priv->finger_state == FS_UNTOUCHED) {
>         stop_coasting(priv);
> +        priv->scroll.delta_y = 0;
> +        priv->scroll.delta_x = 0;
>         if (para->circular_scrolling) {
>             if ((para->circular_trigger == 0 && edge) ||
>                 (para->circular_trigger == 1 && edge & TOP_EDGE) ||
> @@ -2414,8 +2416,6 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
>                 DBG(7, "circular scroll detected on edge\n");
>             }
>         }
> -        priv->scroll.delta_y = 0;
> -        priv->scroll.delta_x = 0;
>      }
>      if (!priv->circ_scroll_on) {
>         if (finger) {

Ok. With a suitably fixed commit message:

Reviewed-by: Chase Douglas <chase.douglas at canonical.com>


More information about the xorg-devel mailing list