[synaptics] On clickpads with two touchpoints, try to detect clickfinger 3 actions

Submitted by Peter Hutterer on Dec. 15, 2013, 11:49 p.m.

Details

Message ID 20131215234910.GA8995@yabbi.redhat.com
State Accepted
Headers show

Not browsing as part of any series.

Commit Message

Peter Hutterer Dec. 15, 2013, 11:49 p.m.
Some touchpads provide BTN_TOOL_TRIPLETAP but do not track more than two
touchpoints. For those, try to detect clickfinger3 actions as best as we can.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
 src/synaptics.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/synaptics.c b/src/synaptics.c
index e391a98..a421384 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2510,6 +2510,28 @@  clickpad_guess_clickfingers(SynapticsPrivate * priv,
         close_point >>= 1;
     }
 
+    /* Some trackpads touchpad only track two touchpoints but announce
+       BTN_TOOL_TRIPLETAP (which sets hw->numFingers to 3).
+       This can affect clickfingers, in the following ways:
+       * one finger down: normal click
+       * two fingers down, close together: 2 finger click
+       * two fingers down, apart: normal click
+       * three fingers down, close together: 3 finger click
+       * three fingers down, with two grouped next to each other: should be
+       * 2-finger click but we can't detect this.
+       * so: if two detected fingers are close together and HW says three
+       * fingers, make it three fingers.
+       * if two detected fingers are apart and HW says three fingers, make
+       * it a two-finger click, guessing that the third finger is somewhere
+       * close to another finger.
+       */
+    if (hw->numFingers >= 3 && nfingers < hw->numFingers) {
+        if (!nfingers) /* touchpoints too far apart apart */
+            nfingers = 2;
+        else
+            nfingers++;
+    }
+
     return nfingers;
 }
 

Comments

On Sun, Dec 15, 2013 at 3:49 PM, Peter Hutterer
<peter.hutterer@who-t.net> wrote:
> Some touchpads provide BTN_TOOL_TRIPLETAP but do not track more than two
> touchpoints. For those, try to detect clickfinger3 actions as best as we can.
>
> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
> ---
>  src/synaptics.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>
> diff --git a/src/synaptics.c b/src/synaptics.c
> index e391a98..a421384 100644
> --- a/src/synaptics.c
> +++ b/src/synaptics.c
> @@ -2510,6 +2510,28 @@ clickpad_guess_clickfingers(SynapticsPrivate * priv,
>          close_point >>= 1;
>      }
>
> +    /* Some trackpads touchpad only track two touchpoints but announce
> +       BTN_TOOL_TRIPLETAP (which sets hw->numFingers to 3).
> +       This can affect clickfingers, in the following ways:
> +       * one finger down: normal click
> +       * two fingers down, close together: 2 finger click
> +       * two fingers down, apart: normal click
> +       * three fingers down, close together: 3 finger click
> +       * three fingers down, with two grouped next to each other: should be
> +       * 2-finger click but we can't detect this.
> +       * so: if two detected fingers are close together and HW says three
> +       * fingers, make it three fingers.
> +       * if two detected fingers are apart and HW says three fingers, make
> +       * it a two-finger click, guessing that the third finger is somewhere
> +       * close to another finger.
> +       */
> +    if (hw->numFingers >= 3 && nfingers < hw->numFingers) {
> +        if (!nfingers) /* touchpoints too far apart apart */

Doubled apart.
On Mon, Dec 16, 2013 at 01:02:41AM -0800, Matt Turner wrote:
> On Sun, Dec 15, 2013 at 3:49 PM, Peter Hutterer
> <peter.hutterer@who-t.net> wrote:
> > Some touchpads provide BTN_TOOL_TRIPLETAP but do not track more than two
> > touchpoints. For those, try to detect clickfinger3 actions as best as we can.
> >
> > Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
> > ---
> >  src/synaptics.c | 22 ++++++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> >
> > diff --git a/src/synaptics.c b/src/synaptics.c
> > index e391a98..a421384 100644
> > --- a/src/synaptics.c
> > +++ b/src/synaptics.c
> > @@ -2510,6 +2510,28 @@ clickpad_guess_clickfingers(SynapticsPrivate * priv,
> >          close_point >>= 1;
> >      }
> >
> > +    /* Some trackpads touchpad only track two touchpoints but announce
> > +       BTN_TOOL_TRIPLETAP (which sets hw->numFingers to 3).
> > +       This can affect clickfingers, in the following ways:
> > +       * one finger down: normal click
> > +       * two fingers down, close together: 2 finger click
> > +       * two fingers down, apart: normal click
> > +       * three fingers down, close together: 3 finger click
> > +       * three fingers down, with two grouped next to each other: should be
> > +       * 2-finger click but we can't detect this.
> > +       * so: if two detected fingers are close together and HW says three
> > +       * fingers, make it three fingers.
> > +       * if two detected fingers are apart and HW says three fingers, make
> > +       * it a two-finger click, guessing that the third finger is somewhere
> > +       * close to another finger.
> > +       */
> > +    if (hw->numFingers >= 3 && nfingers < hw->numFingers) {
> > +        if (!nfingers) /* touchpoints too far apart apart */
> 
> Doubled apart.

that's how far they are apart :)